Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Xcode 9 distribution build fails because format of exportOptions.plist has changed in new release

I am trying to compile an ad-hoc IPA for my app using SDK version 6.1.2 and Xcode 9 beta (trying to see if the app works in the new version). My build is failing with the following error message:

Error Domain=IDEProvisioningErrorDomain Code=9 ""DGHospice.app" 
requires a provisioning profile." UserInfo=
{NSLocalizedDescription="DGHospice.app" requires a provisioning 
profile., NSLocalizedRecoverySuggestion=Add a profile to the 
"provisioningProfiles" dictionary in your Export Options property  
list.}

The Distribution Profile is valid and I can create an IPA if I use iOS SDK 10. Build only fails in 11.0. Can someone help me pinpoint the issue?

like image 532
tutiplain Avatar asked Aug 18 '17 03:08

tutiplain


2 Answers

It appears you using manual code signing (deduced by the Export Options property list in your error message). You should probably switch to automatic code signing as recommended by Apple if it suits your needs.

The problem appears to be that exportOptions.plist format is not compatible with Xcode 9. A bare bones distribution plist for Xcode 9 now looks similar to this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
    <dict>
      <key>provisioningProfiles</key>
      <dict>
        <key>MY_APP_BUNDLE_ID</key>
        <string>MY_PROFILE_NAME_AS_SHOWN_BY_XCODE or UUID_FOUND_IN_MOBILEPROVISION_FILE</string>
      </dict>
      <key>signingCertificate</key>
      <string>iOS Distribution</string>
      <key>signingStyle</key>
      <string>manual</string>
      <key>teamID</key>
      <string>MY_TEAM_ID</string>
  </dict>
</plist>

You can see the list of supported options for the exportOptions.plist by running xcodebuild -help.

You can get a useful overview of how this stuff works in Xcode 9 by watching this video: https://developer.apple.com/videos/play/wwdc2017/403/

You can also get help by searching for 'Manual Signing' in Xcode's search field.

You can create a dummy exportOptions.plist file by following the process documented here by Anna Bátki at BitRise: http://blog.bitrise.io/2017/08/15/new-export-options-plist-in-Xcode-9.html

You should be aware that if you follow Anna's steps using Xcode 9 beta 5, the exportOptionsPlist will not be exported. This behavior works again in Xcode 9 GM.

To determine what the value of your provisioning profile s in the exportOptionsPlist file, you can view the contents of the .mobileprovision file you wish to use and set the key to your application's bundle id ('com.foo') and the value to the UUID of in your .mobileprovision file.

You can see the provisioning profiles the build will be using by looking here: ls ~/Library/MobileDevice/Provisioning\ Profiles/

Another useful tool is using the QuickLooks feature of the Finder to see the values of the provision profiles without having to fire up editor.

like image 65
ablarg Avatar answered Oct 30 '22 07:10

ablarg


use command /Applications/Xcode-beta.app/xcodebuild -help. You'll have an detail information about exportOptionsPlist Available keys for -exportOptionsPlist:

....

provisioningProfiles : Dictionary

For manual signing only. Specify the provisioning profile to use for each executable in your app. Keys in this dictionary are the bundle identifiers of executables; values are the provisioning profile name or UUID to use.

....

Here is a sample about option plist

<?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>provisioningProfiles</key>
    <dict>
        <key>com.aaa.bbb</key>
        <string>adhoc_bbb</string>
        <key>com.aaa.ccc</key>
        <string>adhoc_ccc</string>
    </dict>
    <key>method</key>
    <string>ad-hoc</string>
    <key>uploadBitcode</key>
    <false/>
    <key>uploadSymbols</key>
    <true/>
</dict>
</plist>
like image 11
Victor Choy Avatar answered Oct 30 '22 07:10

Victor Choy