Xcode stuck on embedding provisioning profile
This issue is happening for me on Xcode 9.3 too and it looks like using xcodebuild from the terminal works as expected.
You can export an archive by running (replacing the archive path)
xcodebuild -exportArchive -archivePath "YOUR_XCODE_ARCHIVE_FOLDER/YOUR_ARCHIVE.xcarchive" -exportPath "output/" -exportOptionsPlist "ExportOptions.plist"
You'll need to set up an ExportOptions.plist file with a minimum of:
- 'method' set to either 'app-store', 'enterprise', 'ad-hoc' or 'development'
- 'compileBitcode' set to FALSE
- For manual signing you will need to add your team and provisioning details
More info on Export Options is available here EXPORT .XCARCHIVE TO .IPA USING XCODEBUILD...
My ExportOptions.plist looks like (replace the bundle ID, provisioning profile, team ID and possibly the signingCertificate value):
<?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>enterprise</string>
<key>provisioningProfiles</key>
<dict>
<key>COM.YOUR-BUNDLE-ID</key>
<string>YOUR PROVISIONING PROFILE NAME</string>
</dict>
<key>signingCertificate</key>
<string>iPhone Distribution</string>
<key>signingStyle</key>
<string>manual</string>
<key>teamID</key>
<string>YOUR TEAM ID</string>
</dict>
</plist>
Xcode seems to be recompiling the bitcode while showing this message and it can, therefore, take a very long time to "embed the provisioning profile". If you wait patiently for a very long time, depending on the size of your codebase (including dependencies from Carthage or Cocoapods), it will eventually continue.
@AllanWeir's answer explicitly disables the bitcode compilation by recommending to do so in the plist file, so the time improvement seems to have been an inadvertent side effect. "Fixing" this does NOT require using the command line to export.
I think previous Xcode versions gave more helpful statuses during bitcode re-compilation.
You can disable the bitcode compilation during Xcode export via the UI and it will no longer get "stuck".