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 ios ios

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 NoteiCloudContainerEnvironment = 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 Requesthttps://github.com/apache/cordova-ios/pull/338/commits

Forkhttps://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!


While help is coming and you don't want to use Xcode directly (and I don't judge you 😉)... here is a temporary solution which worked fine for me:

remove ios

cordova platform rm ios

add ios from dev brunch where this issue already fixed.(Later you will be able to use ios v4.6.0 or whatever final # is going to be)

cordova platform add https://github.com/apache/cordova-ios.git

I hope it will help you too! 🙂


For who land of the following error

error: exportArchive: exportOptionsPlist error for key 'iCloudContainerEnvironment': expected one of {Development, Production}, but no value was provided

All you need to do it this to create a build

ionic cordova build ios --prod --release -- --iCloudContainerEnvironment=Production

More info:


matomo