Currently we are in a very strange situation with our Xcode build for an IOS App. Archiving our app with
xcodebuild -workspace App.xcworkspace -scheme AppName -sdk iphoneos clean archive -archivePath archive/AppName.xcarchive
is working flawless. However, pushing this archive to Apple with the following command:
xcodebuild -exportArchive -archivePath App/archive/AppName.xcarchive -exportOptionsPlist ExportOptionsAppStore.plist -exportPath App/archive/AppName -allowProvisioningUpdates
and belonging ExportOptionsAppStore.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>destination</key>
<string>upload</string>
<key>method</key>
<string>app-store</string>
<key>signingStyle</key>
<string>automatic</string>
<key>stripSwiftSymbols</key>
<true/>
<key>teamID</key>
<string>our-team-id</string>
<key>uploadSymbols</key>
<true/>
<key>manageAppVersionAndBuildNumber</key>
<false/>
</dict>
</plist>
Is most of the time failing with random errors, and after 2 or 3 retries it succeed. But sometimes it succeed the first time. There is not logical explanation for this.
We are running this build in our GitLab CI (our runner is a Macbook Air), but running this directly on the MacBook Air resulting in the same error.
The random errors are:
2023-02-28 09:27:47.035 xcodebuild[21915:7489205] Starting upload
2023-02-28 09:27:47.630 xcodebuild[21915:7489206] Progress 0%: Making copy of ‘AppName.ipa’…
2023-02-28 09:27:47.631 xcodebuild[21915:7489206] Progress 0%: Making copy of ‘AppName.ipa’…
2023-02-28 09:27:47.633 xcodebuild[21915:7489206] Progress 0%: Preparing to upload ‘AppName.ipa’…
2023-02-28 09:27:47.671 xcodebuild[21915:7489206] Progress 0%: Analyzing package…
2023-02-28 09:27:57.919 xcodebuild[21915:7489211] Progress 0%: Failed to retrieve upload operations. Will re-try.
2023-02-28 09:28:00.251 xcodebuild[21915:7489211] Progress 0%: Failed to retrieve upload operations. Will re-try.
2023-02-28 09:28:02.593 xcodebuild[21915:7489211] Progress 0%: Failed to retrieve upload operations. Giving up.
2023-02-28 09:28:02.792 xcodebuild[21915:7489211] Progress 0%: Failed to retrieve upload operations. Will re-try.
2023-02-28 09:28:05.247 xcodebuild[21915:7489211] Progress 0%: Failed to retrieve upload operations. Will re-try.
2023-02-28 09:28:07.577 xcodebuild[21915:7489211] Progress 0%: Failed to retrieve upload operations. Giving up.
2023-02-28 09:28:07.580 xcodebuild[21915:7489211] Progress 0%: Collecting package attributes…
2023-02-28 09:28:07.582 xcodebuild[21915:7489211] Progress 0%: Requesting upload instructions from App Store Connect…
2023-02-28 09:28:07.784 xcodebuild[21915:7489211] Progress 0%: Upload failed.
The provided entity includes a relationship with an invalid value
'' is not a valid id for the relationship 'build' (ID: 00a00ab0-a0f0-0000-a00b-0000c0000ecf)
error: exportArchive: The provided entity includes a relationship with an invalid value. '' is not a valid id for the relationship 'build' (ID: 00a00ab0-a0f0-0000-a00b-0000c0000ecf).
Error Domain=ContentDelivery Code=409 "error: The provided entity includes a relationship with an invalid value. '' is not a valid id for the relationship 'build' (ID: 00a00ab0-a0f0-0000-a00b-0000c0000ecf)." UserInfo={NSLocalizedDescription=error: The provided entity includes a relationship with an invalid value. '' is not a valid id for the relationship 'build' (ID: 00a00ab0-a0f0-0000-a00b-0000c0000ecf).}
** EXPORT FAILED **
2023-02-28 09:28:59.848 xcodebuild[22503:7491133] Starting upload
2023-02-28 09:29:00.452 xcodebuild[22503:7491178] Progress 0%: Making copy of ‘AppName.ipa’…
2023-02-28 09:29:00.454 xcodebuild[22503:7491178] Progress 0%: Making copy of ‘AppName.ipa’…
2023-02-28 09:29:00.456 xcodebuild[22503:7491178] Progress 0%: Preparing to upload ‘AppName.ip’…
2023-02-28 09:29:00.461 xcodebuild[22503:7491178] Progress 0%: Upload failed.
Failed to upload package ‘AppName.ipa’.
You must provide the Apple ID of the package.
error: exportArchive: Failed to upload package ‘AppName.ipa’. You must provide the Apple ID of the package.
Error Domain=ContentDelivery Code=-19211 "error: Failed to upload package ‘AppName.ipa’. You must provide the Apple ID of the package." UserInfo={NSLocalizedDescription=error: Failed to upload package ‘AppName.ipa’. You must provide the Apple ID of the package.}
error: exportArchive: Failed to upload package ‘AppName.ipa’. You must provide the Public Provider ID for the package.
Error Domain=ContentDelivery Code=-19210 "error: Failed to upload package ‘AppName.ipa’. You must provide the Public Provider ID for the package." UserInfo={NSLocalizedDescription=error: Failed to upload package ‘AppName.ipa’. You must provide the Public Provider ID for the package.}
** EXPORT FAILED **
2023-02-28 11:25:43.992 xcodebuild[42596:7578942] Starting upload
2023-02-28 11:25:44.665 xcodebuild[42596:7578954] Progress 0%: Making copy of ‘AppName.ipa’…
2023-02-28 11:25:44.667 xcodebuild[42596:7578954] Progress 0%: Making copy of ‘AppName.ipa’…
2023-02-28 11:25:44.669 xcodebuild[42596:7578945] Progress 0%: Preparing to upload ‘AppName.ipa’…
2023-02-28 11:25:44.710 xcodebuild[42596:7578945] Progress 0%: Analyzing package…
2023-02-28 11:25:54.060 xcodebuild[42596:7578958] Progress 0%: Failed to retrieve upload operations. Will re-try.
2023-02-28 11:25:56.642 xcodebuild[42596:7578958] Progress 0%: Sending analysis to App Store Connect…
2023-02-28 11:25:57.588 xcodebuild[42596:7578958] Progress 0%: Waiting for App Store Connect analysis response…
2023-02-28 11:26:03.758 xcodebuild[42596:7578999] Progress 0%: Sending SPI analysis to App Store Connect…
2023-02-28 11:26:04.095 xcodebuild[42596:7578999] Progress 0%: Waiting for App Store Connect SPI analysis response…
2023-02-28 11:26:14.682 xcodebuild[42596:7578958] Progress 0%: Collecting package attributes…
2023-02-28 11:26:14.684 xcodebuild[42596:7578958] Progress 0%: Requesting upload instructions from App Store Connect…
2023-02-28 11:26:14.896 xcodebuild[42596:7578958] Progress 0%: Upload failed.
Account credentials have expired.
error: exportArchive: Account credentials have expired. Open Xcode's Accounts preference pane, sign in to your account, and try again.
Error Domain=DVTITunesSoftwareServiceFoundation.AuthContextDelegateError Code=0 "error: Account credentials have expired. Open Xcode's Accounts preference pane, sign in to your account, and try again." UserInfo={NSLocalizedDescription=error: Account credentials have expired. Open Xcode's Accounts preference pane, sign in to your account, and try again.}
** EXPORT FAILED **
Xcode was running on version 14.1 and we upgrade Xcode to 14.2 without any luck. Also we logged out our logged in user, but even that had no luck.
But the point here is, it succeed after 2 or 3 retries or it succeed the first time.