Xcode 8.3 xcodebuild error with code signing

Hi there,


After my upgrade to Xcode 8.3, I'm running into an issue creating a .ipa file from the command line.


Previously I was running a 2-part process to build my project and create an xcarchive file, then export that xcarchive to a .ipa file.


Previous Script:

  1. xcodebuild -workspace myproject.xcworkspace -scheme MyProject archive -archivePath MyProject.xcarchive
  2. xcodebuild -exportArchive -exportFormat ipa -archivePath MyProject.xcarchive -exportPath MyProject -exportProvisioningProfile "MyProvisioningProfile"


I've updated -exportFormat to using the exportOptionsPlist (I added method=ad-hoc in my exportOptions.plist)

  1. xcodebuild -workspace myproject.xcworkspace -scheme MyProject archive -archivePath MyProject.xcarchive
  2. xcodebuild -exportArchive -exportOptionsPlist exportOptions.plist -archivePath MyProject.xcarchive -exportPath MyProject


I noticed that -exportProvisioningProfile is an invalid option, and when I omit it, I get an export failed.


Error Domain=IDEDistributionErrorDomain Code=1 "No valid iOS Distribution signing identities belonging to team ABCDEFGHIJKL were found." UserInfo={NSLocalizedDescription=No valid iOS Distribution signing identities belonging to team ABCDEFGHIJKL were found.}

** EXPORT FAILED **


Can someone please let me know how I can specify the provisioning profile that's supposed to be used to sign this export? I couldn't find any resources that documents this change in xcode 8.3.


Thanks,

Vic

Replies

1 create plist file,a.plist for example:


<?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>uploadSymbols</key>

<false/>

<key>uploadBitcode</key>

<false/>

<key>method</key>

<string>enterprise</string>

<key>compileBitcode</key>

<false/>

</dict>

</plist>


2 use

xcodebuild -exportArchive -archivePath adhoc.xcarchive -exportPath . -exportOptionsPlist a.plist


method can be one of app-store, ad-hoc, enterprise, development,depends on what you do have in your computer

@HelloCoral

Thank you for the response.


This is what my 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>method</key>

<string>ad-hoc</string>

</dict>

</plist>


It's a simple plist with the exception of specifying the build as a .ipa. Whether I set the method to "ad-hoc" or "enterprise" doesn't solve the code signing issue. The problem is my Xcode project uses automatic management of code signing profiles and it creates its own provisioning profile. Previously, I was able to export the profile and have the export step recognize the correct code signing identity.

(-exportProvisioningProfile "MyProvisioningProfile"). Unfortunately now that the option is removed, I don't know if there is an alternative for me to specify the specific provisioning profile to do the code signing. If possible, I want to avoid changing my project to manual code signing as the benefits of automatic code signing is quite large.


Searching back through the release notes, I only see -exportFormat being removed and documented. The removal of -exportProvisioningProfile is a complete surprise to me.

I figured out what's going on. Previously, I was able to piggyback off the generated provision profiles of the Automatic Code Signing feature of Xcode. It seems like the ability to export a provision profile has been removed in Xcode 8.3 via xcodebuild -exportProvisioningProfile which means I had to make sure I had the proper signing distribution certificates.


When exporting to a .ipa, you always need a distribution certificate based on your development team even if you use a development certificate to sign the xcarchive.

Hi!


I think I've got it figured out...


instead of:

-exportProvisioningProfile "MyProvisioningProfile"


use:

PROVISIONING_PROFILE_SPECIFIER="MyProvisioningProfile"

We've got unity building the project every time and it doesn't fill in the PROVISIONING_PROFILE or PROVISIONING_PROFILE_SPECIFIER. And it looks like it will figure out the alphabet soup that belongs to PROVISIONING_PROFILE by looking it up itself provided you have downloaded it already.

Tangentially to this I am using Jenkins (installed via brew) to build a Unity iOS app and got the:

"No valid iOS Distribution signing identities belonging to team *** were found"

What worked for me was giving commandline access to the keychain with:

$ security unlock-keychain

Then the keychain was available and Jenkins could sign and finish the export. 😉


Now it works. Next step is getting this to work out of the box on a restart.

(I guess the core issue is that Jenkins/commandline build does not have access to the keychain and does not prompt for access.)