Search code examples
iosbuildreleasexcodebuild

error: exportArchive: The operation couldn’t be completed. (IDEDistributionErrorDomain error 3.)


I am building iOS project on command line using xcodebuild. Building with Release configuration is ok which created and App.xcarchive. Then I am trying to export archive for App Store IPA using,

xcodebuild -exportArchive -archivePath App.xcarchive -exportPath ~/output/ -exportOptionsPlist appstore.plist

My appstore.plist,

<?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>teamID</key>
<string>T3AM1D</string>
<key>method</key>
<string>app-store</string>
</dict>
</plist

This gives me error,

error: exportArchive: The operation couldn’t be completed.(IDEDistributionErrorDomain error 3.)

Any help will be appreciated.


Solution

  • Finally I was able to solve this issue.

    Solution Steps

    1. Make sure all profiles and certificates are setup successfully in Mac
    2. Make sure no red mark is shown from Xcode, For example Xcode->targets->Build settings ->Profiles and signing identity + team
    3. Make sure that all targets including MainApp, Widgets, Extensions are also configures without issue
    4. Make sure that all capabilities, appgroup and keychains are OK
    5. Important: Make sure that from Xcode -> Product -> Archive -> export to App Store IPA ran at least one time
    6. When running xcodebuild from command line, make sure that Xcode is closed

    Hope this helps