Skip to content

Commit

Permalink
gomobile: use Apple Developer as certificate name
Browse files Browse the repository at this point in the history
  • Loading branch information
changkun committed Aug 24, 2021
1 parent 34ab130 commit 24ca07c
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions cmd/gomobile/build_iosapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,16 +152,24 @@ func goIOSBuild(pkg *packages.Package, bundleID string, archs []string) (map[str
}

func detectTeamID() (string, error) {
// Grabs the first certificate for "iPhone Developer"; will not work if there
// Grabs the first certificate for "Apple Developer"; will not work if there
// are multiple certificates and the first is not desired.
cmd := exec.Command(
"security", "find-certificate",
"-c", "iPhone Developer", "-p",
)
pemString, err := cmd.Output()
if err != nil {
err = fmt.Errorf("failed to pull the signing certificate to determine your team ID: %v", err)
return "", err
// If no "iPhone Developer" cert is found then try the new "Apple Development".
cmd := exec.Command(
"security", "find-certificate",
"-c", "Apple Development", "-p",
)
pemString, err = cmd.Output()
if err != nil {
err = fmt.Errorf("failed to pull the signing certificate to determine your team ID: %v", err)
return "", err
}
}

block, _ := pem.Decode(pemString)
Expand Down Expand Up @@ -422,7 +430,7 @@ var projPbxprojTmpl = template.Must(template.New("projPbxproj").Parse(`// !$*UTF
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "Apple Development";
COPY_PHASE_STRIP = NO;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
Expand All @@ -435,7 +443,7 @@ var projPbxprojTmpl = template.Must(template.New("projPbxproj").Parse(`// !$*UTF
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 8.3;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
Expand Down

0 comments on commit 24ca07c

Please sign in to comment.