After Upgrading to Xcode 9, Cordova App Won't Build, Error 70, Requires Provisioning Profile

After upgrading to xcode 9, cordova app won't build, error 70, requires provisioning profile

If you specify your provisioning profile explicitly, like me. Like this in your Cordova build.json:

"ios": {
"debug": {
"codeSignIdentitiy": "iPhone Developer",
"developmentTeam":"MYTEAMID",
"packageType": "developer",
"iCloudContainerEnvironment": "Development"
},
"release": {
"codeSignIdentitiy": "iPhone Distribution",
"developmentTeam":"MYTEAMID",
"provisioningProfile": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"packageType": "ad-hoc",
"iCloudContainerEnvironment": "Production"
}
}

Please Note
iCloudContainerEnvironment = Production/Development is only required if you use push notifications

You need to explicitly set manual signing and provide the provisioning keys in your ExportOptions.plist that is generated by Cordova. Unfortunately Cordova is not currently generating all of the required keys.

Here is what it needs to look like, at least for me:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<false/>
<key>method</key>
<string>ad-hoc</string>
<key>iCloudContainerEnvironment</key >
<string>Production</string>
<key>provisioningProfiles</key>
<dict>
<key>my.bundle.idenifier</key>
<string>My Provisioning Profile Name</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>YOURTEAMID</string>
<key>thinning</key>
<string><none></string>
</dict>
</plist>

The file Cordova generates @ cordova/app/platforms/ios/exportOptions.plist looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>compileBitcode</key>
<false/>
<key>method</key>
<string>development</string>
<key>teamID</key>
<string>MYTEAMID</string>
</dict>
</plist>

notice it is missing the important bits that Xcode 9 requires.

I generated the correct file by archiving the build manually, then exporting it which also creates the exportOptions.plist that I now use as reference.

After digging deeper, I found that this cannot be fixed after running "Cordova add platform iOS", because it is generated during the build phase dynamically. I decided to fork the Cordova-ios repo and submit a pull request. You may use my fork directly, or wait until the pull request is merged.

Pull Request
https://github.com/apache/cordova-ios/pull/338/commits

Fork
https://github.com/jrryhrtn/cordova-ios

Usage notes from pull request

See example below, please note that the provisioning profile can be the name or UUID of the profile. Name is preferred for maintenence, as UUID changes each time to regenerate the profile.

{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam":"YOURTEAMID",
"provisioningProfile": "provisioning profile name or UUID",
"packageType": "development"
},
"release": {
"codeSignIdentity": "iPhone Distribution",
"developmentTeam":"YOURTEAMID",
"provisioningProfile": "provisioning profile name or UUID",
"packageType": "ad-hoc"
}
}
}

I plan to manually patch until the/a fix is merged into the next Cordova release. You will have to regenerate your iOS platform after the patch via "Cordova platform rm iOS" and then "Cordova platform add ~/forks/cordova-ios". ~/forks/cordova-ios my local path, use the path on your local machine where you downloaded the forked Cordova-ios repo.

Update

cordova-ios 4.5.2 has been officially released! Upgrade by running the following commands: "cordova platform rm ios", and then "cordova platform add ios@4.5.2"

Cheers!

After upgrading to xcode 9, cordova app won't build, error 70, requires a provisioning profile with the Push Notifications feature

After upgrade my cordova project to Cordova@7.1.0, and change my build.json below:

{
"ios": {
"debug": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "yourTemaID",
"packageType": "development",
"automaticProvisioning": true,
"buildFlag": [
"EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
"LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
]
},
"release": {
"codeSignIdentity": "iPhone Developer",
"developmentTeam": "yourTemaID",
"packageType": "app-store",
"automaticProvisioning": true,
"buildFlag": [
"EMBEDDED_CONTENT_CONTAINS_SWIFT = YES",
"ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES=NO",
"LD_RUNPATH_SEARCH_PATHS = \"@executable_path/Frameworks\""
]
}
}}

Now,everything work like a charm!

Cordova Doc iOS build.json

Building ios-app Error Domain=IDEProvisioningErrorDomain Code=9

Create a development/distribution provisioning profile in developer.apple.com portal, then specify TEAMID and provisioning profile in build.json config file:

"ios": {
"debug": {
"codeSignIdentitiy": "iPhone Developer",
"developmentTeam":"MYTEAMID",
"provisioningProfile": "Provisoning profile name",
"packageType": "developer"
},
"release": {
"codeSignIdentitiy": "iPhone Distribution",
"developmentTeam":"MYTEAMID",
"provisioningProfile": "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX",
"packageType": "app-store"
}
}

More info of how to create provisioning profile are available here, in official TACO guide : Create a Provisioning Profile

Check dependencies error in Cordova iOS build

After a disgusting amount of time spent on this, I was finally able to get mine published... I'll outline what I remember of the workflow below:

  • run ionic cordova platform rm ios then ionic cordova platform add ios
  • open Xcode and select your development team, keep the signing set to automatic
  • run ionic cordova build ios --proddon't add the --release flag
  • if you now have a .xcarchive file in platforms/ios, open it in Xcode and skip to the very bottom, otherwise continue to the next point
  • open the .xcodeproj file and click Product > Archive – this will create the release build
  • If you get the "check dependencies" error at this point:

    • uncheck / disable automatic signing
    • re-check / enable automatic signing
    • run Product > Archive again

This should successfully build your app release, at which point you'll have the option to "Submit to App Store"... Good luck!



Related Topics



Leave a reply



Submit