"Xcode Archive & Export for iOS" failing with “[name].app requires a provisioning profile. Add a profile to the "provisioningProfiles" dictionary in your Export Options property list”


#1

Bitrise Build Issue Report template

Description of the issue

I have a React Native App (URL: https://app.bitrise.io/app/27a03d689b43c1a8) that I’ve been building before here on Bitrise. This was back when Xcode 9 was still used. Now that I’ve picked up developing again, I’m just trying to rebuild the app as it was. Differences between now and then: Xcode 10 is used, and I’ve updated React Native to the latest version (0.57.4), as the older RN 0.53.x didn’t play nice with Xcode 10. Furthermore I’ve had to generate new provisioning profiles as my developer certificate expired about a month ago.

Locally everything works fine

  • I can run the app in my debugger
  • I can successfully build the app
  • I can successfully archive the app + export it to a .ipa.

On Bitrise however I can not export the archive to a .ipa. The last step in my workflow “Xcode Archive & Export for iOS” (version 2.4.16) fails on it:

[06:25:58] set -o pipefail && xcodebuild “-exportArchive” “-archivePath” “/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__archive__377197148/XXXXXXXXXX.xcarchive” “-exportPath” “/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__export__892447755” “-exportOptionsPlist” “/Users/vagrant/deploy/export_options.plist” | xcpretty

:x: error: exportArchive: “XXXXXXXXXXX.app” requires a provisioning profile.

:x: Error Domain=IDEProvisioningErrorDomain Code=9 ““XXXXXXXXXXX.app” requires a provisioning profile.” UserInfo={NSLocalizedDescription=“EVPointMobile.app” requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the “provisioningProfiles” dictionary in your Export Options property list.}

The generated export_options.plist file looks fine by me. Even manually overriding (cfr. these instructions) it to the snippet below (which I’ve redacted a bit) also leads to no success:

<?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>development</string>
    <key>teamID</key>
    <string>XXXXXXXXXX</string>
    <key>provisioningProfiles</key>
    <dict>
        <key>xx.xxxxx.xxxx</key>
        <string>development</string>
    </dict>
    <key>signingCertificate</key>
    <string>iPhone Developer: Bram Van Damme (XXXXXXXXXX)</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>compileBitcode</key>
    <false/>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>thinning</key>
    <string>&lt;none&gt;</string>
</dict>
</plist>

:thinking: So now I’m kinda scratching my head here, as the .plist file clearly contains the required provisioningProfiles of which the error is complaining about.

As a reminder: Locally running the xcodebuild command above (using said .plist file as the -exportOptionsPlist) works fine … a .ipa is generated.

Furthermore I’ve verified that:

  • The teamID string contains the correct value
  • The signingCertificate string contains the correct value
  • The key and string value inside provisioningProfiles are correct
  • The uploaded Identities.p12 file includes the correct identities
  • The uploaded .mobileprovision file lines up with everything else (it references my developer certificate, it’s type is for development, etc)

Environment:

Where did the issue happen?

Bitrise Stack: “Default (Hybrid (Xamarin, Ionic, …) on macOS, includes Visual Studio for Mac, Stable channel)”

Which build Step causes the issue and which version of the step?

Xcode Archive & Export for iOS 2.4.16

Reproducibility

  • Does a “Rebuild” help? (You can trigger a rebuild from the Build’s page, by clicking the “Rebuild” button in the top right corner of a finished build) : NO
  • Does a rebuild without caches help? (You can remove the Cache:Pull and Cache:Push steps temporarily to not to use the cache, or you can delete all the caches on the Settings tab of the app. : NO
  • Does the issue happen sporadically, or every time? : EVERY TIME
  • Does upgrading the build Step to the latest version help? : NO
  • When did the issue start? : UNKNOWN

N/A

Build log

▸ Compiling XXXXXXXXXX_vers.c
▸ Linking XXXXXXXXXX
▸ Compiling AppDelegate.m
▸ Linking XXXXXXXXXX
▸ Compiling LaunchScreen.xib
▸ Processing Info.plist
▸ Running script 'Bundle React Native code and images'
    the transform cache was reset.
▸ Generating 'XXXXXXXXXX.app.dSYM'
▸ Touching XXXXXXXXXX.app (in target: XXXXXXXXXX)
▸ Archive Succeeded
Archive infos:
team: XXXXXXXXXX (XXXXXXXXX)
profile: development (c88100d3-1fe0-4f5c-af78-bfcd1c9e2340)
export: development
xcode managed profile: false
Exporting ipa from the archive...
Exporting ipa with ExportOptions.plist
Custom export options content provided, using it:
<?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>development</string>
    <key>teamID</key>
    <string>XXXXXXXXX</string>
    <key>provisioningProfiles</key>
    <dict>
        <key>XX.XXXXXXX.XXXX</key>
        <string>development</string>
    </dict>
    <key>signingCertificate</key>
    <string>iPhone Developer: Bram Van Damme (XXXXXXXXXX)</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>compileBitcode</key>
    <false/>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>thinning</key>
    <string><none></string>
</dict>
</plist>
[06:25:58] set -o pipefail && xcodebuild "-exportArchive" "-archivePath" "/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__archive__377197148/XXXXXXXXXX.xcarchive" "-exportPath" "/var/folders/90/5stft2v13fb_m_gv3c8x9nwc0000gn/T/__export__892447755" "-exportOptionsPlist" "/Users/vagrant/deploy/export_options.plist" | xcpretty
❌  error: exportArchive: "XXXXXXXXXX.app" requires a provisioning profile.
❌  Error Domain=IDEProvisioningErrorDomain Code=9 ""XXXXXXXXXX.app" requires a provisioning profile." UserInfo={NSLocalizedDescription="XXXXXXXXXX.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}
If you can't find the reason of the error in the log, please check the raw-xcodebuild-output.log
The log file is stored in $BITRISE_DEPLOY_DIR, and its full path
is available in the $BITRISE_XCODE_RAW_RESULT_TEXT_PATH environment variable
IDEDistribution.critical.log:
Also please check the xcdistributionlogs
The logs directory is stored in $BITRISE_DEPLOY_DIR, and its full path
is available in the $BITRISE_IDEDISTRIBUTION_LOGS_PATH environment variable
Export failed, error: exit status 70

#2

Found my issue: one of my earlier steps in my workflow modified the app identifier to add a .preview suffix — This way we are able to install both the preview and the app-store version on devices.

Because of this change the .plist file of course targeted the wrong app inside the provisioningProfiles dictionary. A better warning would’ve helped to locate the source of the error.

On a sidenote: strange though that the automatic generation of the .plist file inside the xcode-archive@2.4.16 step – e.g. its “generating provisioningProfiles node” part – does not detect the changed CFBundleIdentifier from the app’s Info.plist file.


#3

Hi @bramus, glad to hear you’ve managed to sort this out so quickly!