2
votes

to automate my app build process, I am trying to build my iOS app via command line

Build command

xcodebuild archive -project sample.xcodeproj -scheme "sample" -archivePath $PWD/archive/sample.xcarchive -destination generic/platform=iOS -UseModernBuildSystem=NO

Export Command

xcodebuild -exportArchive -archivePath $PWD/archive/sample.xcarchive -exportOptionsPlist ./ExportOptions.plist -exportPath $PWD/build -UseModernBuildSystem=NO

Following is the error

Error Domain=IDEProvisioningErrorDomain Code=9 ""sample.app" requires a provisioning profile." UserInfo={IDEDistributionIssueSeverity=3, NSLocalizedDescription="sample.app" requires a provisioning profile., NSLocalizedRecoverySuggestion=Add a profile to the "provisioningProfiles" dictionary in your Export Options property list.}

Please note that the archive from Xcode works fine. And the Info.plist file from archive folder archive/sample.xcarchive/Info.plist does not contain provisioning profiles dictionary.

As per other suggestions on google and StackOverflow, I have tried the following

  1. Changed build settings to Legacy build
  2. Removed Provisioning profiles folder from ~/Library/MobileDevice
  3. Upgraded Xcode to latest (currently 11.4)
  4. created a softling of ~/Library/MobileDevice in /Library/MobileDevice
  5. Recreated provisioning profile in developer account.

Could anyone help me get over this issue?

2
You have to create a export option plist. in that you have to specify the build rules and provision profiles. - vishnu anilkumar
If you look into my export command, that is exactly what i did. - blganesh101

2 Answers

2
votes

What has finally worked is to remove wildcard while mentioning the App id in the exportOptions.plist file.

<?xml version="1.0" encoding="UTF-8"?>
<dict>
    <key>provisioningProfiles</key>
    <dict>
        <key>APP_ID_WITHOUT_WILDCARD_CHAR</key>
        <string>PROVISIOING_PROFILE_NAME_AS_SEEN_BY_XCODE</string>
    </dict>
    <key>method</key>
    <string>app-store</string>
    <key>signingCertificate</key>
    <string>iPhone Distribution</string>
    <key>signingStyle</key>
    <string>manual</string>
    <key>stripSwiftSymbols</key>
    <true/>
    <key>teamID</key>
    <string>TEAM_ID</string>
    <key>uploadSymbols</key>
    <true/>
</dict>
</plist>
1
votes

I got the same error after upgrading to XCode 11.3. It's related to new Apple Development and Apple Distribution certificate types.

Edit provisioning profile and select use in Xcode 11. Use this new provisioning profile to fix this error.