32

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?

Kamchatka
  • 3,597
  • 4
  • 38
  • 69
tutiplain
  • 1,427
  • 4
  • 19
  • 37

2 Answers2

44

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.

ablarg
  • 2,400
  • 1
  • 24
  • 32
  • Thanks for the suggestion. I will try it out and write back. Actually I am using Appcelerator Titanium, which creates its own exportOptions.plist. Guess their tooling is not yet compatible with Xcode 11. I can manually edit the generated plist with your suggestions, though. – tutiplain Aug 27 '17 at 11:18
  • This worked with xcode 9.2. Do not include the team prefix in the `MY_APP_BUNDLE_ID`. The .mobileprovision file is not binary, but you can still `cat` it to get the values. – Cameron Taggart Feb 27 '18 at 18:56
11

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>
Victor Choy
  • 4,006
  • 28
  • 35
  • 1
    I found with my Travis stack, and my manual signing, that the uploadBitcode/false key/value was essential to success. Evidently Xcode 9 defaults to true and that blocks Travis from deploying the .ipa. – Matt Bearson Sep 28 '17 at 15:46