Yesterday we upgraded from xcode 8.3.2 to version 9. And now our enterprise distribution apache cordova ios app refuses to build.
2017-09-21 07:37:16.787 xcodebuild[70400:217569] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path '/var/folders/wj/yj3cfvh954gbc_btlhcrcx7nk7t4dj/T/App Name_2017-09-21_07-37-16.786.xcdistributionlogs'. 2017-09-21 07:37:16.938 xcodebuild[70400:217569] [MT] IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7ff756bbdf70>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed." UserInfo={NSLocalizedDescription=Locating signing assets failed., IDEDistributionSigningAssetStepUnderlyingErrors=( "Error Domain=IDEProvisioningErrorDomain Code=9 \"\"App Name.app\" requires a provisioning profile.\" UserInfo={NSLocalizedDescription=\"App Name.app\" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the \"provisioningProfiles\" dictionary in your Export Options property list.}" )} error: exportArchive: "App Name.app" requires a provisioning profile. Error Domain=IDEProvisioningErrorDomain Code=9 ""App Name.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="App Name.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.} ** EXPORT FAILED ** Error: Error code 70 for command: xcodebuild with args: -exportArchive,-archivePath,App Name.xcarchive,-exportOptionsPlist,/Users/Shared/Workspace/github/AppName/platforms/ios/exportOptions.plist,-exportPath,/Users/Shared/Workspace/github/AppName/platforms/ios/build/device
(I replaced the apps name with "App Name" for this question)
I have verified that all the certs and provisioning profiles are set in xcode. And the build.json is set. I'm not really a Mac guy and I'm stumped on what to do next.
-Edit, Downgrading xcode to 8.3.3 fixed the problem. Not an ideal solution but not much I can do.
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 [email protected]"
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! 🙂
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With