Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xcodebuild -exportArchive fails with error Locating signing assets failed

I'm using command line xcodebuild tool to export .ipa files from Xcode archives. It was working fine up to Xcode 8.3.3. The same setup has stopped working with Xcode 9 beta. Now it fails with this error:

IDEDistribution: Step failed: <IDEDistributionSigningAssetsStep: 0x7fc309310550>: Error Domain=IDEDistributionSigningAssetStepErrorDomain Code=0 "Locating signing assets failed."

It seems Xcode 9 cannot locate the provisioning profiles, but why?

like image 786
Vladimir Grigorov Avatar asked Jul 17 '17 07:07

Vladimir Grigorov


2 Answers

In my case the issue was solved by the next fields in the -exportOptionsPlist plist:

<dict>
  <key>compileBitcode</key>
  <false/>

  <key>method</key>
  <string>ad-hoc</string>

  <key>provisioningProfiles</key>
  <dict>
      <key>com.my.bundle.id</key>
      <string>AD_HOC_PROVISIONING_PROFILE_NAME</string>
  </dict>

  <key>signingCertificate</key>
  <string>CERTIFICATE_HASH</string>

  <key>signingStyle</key>
  <string>manual</string>

  <key>teamID</key>
  <string>TEAM_ID</string> 
</dict>

So, apparently I had to set: compileBitcode, method, provisioningProfiles, signingCertificate, signingStyle and teamID.

In your case the set of fields can be different. I have found out my set by archiving and exporting the .ipa through Xcode 9. Xcode will export its exportOptionsPlist with the ipa and show what fields it used.

More info on the fields discovery: https://blog.bitrise.io/new-export-options-plist-in-xcode-9

like image 79
Anton Ogarkov Avatar answered Nov 05 '22 01:11

Anton Ogarkov


I was running this command:

xcodebuild -exportArchive -archivePath archive.xcarchive -exportPath /my/export/path -exportOptionsPlist options.plist

My project uses manual signing. It turns out Xcode 9 needs the provisioning profile names or UUIDs specified in options.plist in order to sign the exported .ipa file. I added this entry to my options.plist:

<key>provisioningProfiles</key>
<dict>
    <key>com.myapp.bundle.id</key>
    <string>My AdHoc Provisioning Profile Name</string>
</dict>

And the error "Locating signing assets failed" was gone. However there was another error:

IDEDistribution: Step failed: : Error Domain=IDEFoundationErrorDomain Code=1 "ipatool failed with an exception: #

Xcode 9 recompiles the app from bitcode by default. I got over this error by turning bitcode off by adding another entry to my options.plist:

<key>compileBitcode</key>
<false/>

Now I'm finally able to build my app with Xcode 9 and export ipa files with xcodebuild without errors.

like image 11
Vladimir Grigorov Avatar answered Nov 05 '22 02:11

Vladimir Grigorov