2
votes

I'm using Xcode 11 and Xcode server to try build and upload my app to TestFlight. I was trying to use a custom ExportOptions.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>method</key>
    <string>app-store</string>
    <key>teamID</key>
    <string>YOUR_TEN_CHARACTER_TEAM_ID</string>
    <key>destination</key>
    <string>upload</string>
</dict>
</plist>

But then I get an error saying "Upload" is not supported by Xcode server. Suggestions online are to leave it as "Export" and use this to upload in a post-integration script:

altool --upload-app -f $XCS_PRODUCT -u <username> -p <app-specific password>

So I did that and I've tried setting the bot to use either:

  • Archive export: Installable Product
  • Archive export: Installable Product & Thinned Variants

instead of the custom plist. But now my Archive step is failing with the below error before even getting to the trigger:

Build Service Error: exportArchive: exportOptionsPlist error for key 'destination': expected one of {upload}, but found export

I've tried removing the trigger to see if that was causing an issue, but its not. Now my bot is simply trying to archive and export the project and i'm getting this error about destination should be upload ... which isn't supported.

Archiving the app and uploading from the "Distribute app" manually works fine.

Any help would be appreciated. I was hoping to do this without adding more tools as it should be possible on its own.

1
I am fighting with the same problem at the moment... I am thinking that some cache needs purging somewhere. Exporting went fine before I set the custom ExportOptions.plist, and after that I can't seem to get it working anymore, even after I have removed the ExportOptions.plist. I get the same error as you. I have no clue where this destination key "export" keeps coming from :/Kristof Van Landschoot
@KristofVanLandschoot destination export is coming from xcode server / the bot. Under "configuration" you can tick/untick "archive" and next to that there are various export options to choose from. Picking one of those will add the key. The problem is, my understanding is that destination export is what its supposed to be. Upload isn't supported, so it must be export then. I'm now assuming its a bug in xcode/xcode serverSimon McLoughlin
I am with you on that assumption. I disabled it altogether and did the export in the post trigger based on the ${XCS_ARCHIVE} generated by Xcode. In the end I set up my signing in my Xcode project anyway, so it may even make more sense like that.Kristof Van Landschoot
@KristofVanLandschoot can you add an answer below with your post trigger? I tried to do that too but kept getting an error saying flag -exportOptionsPlist is required when specifying -exportArchive I am adding that flag, but it still won't work for meSimon McLoughlin

1 Answers

1
votes

As discussed in the comments this is probably a bug in Xcode server.

Since the Xcode project already creates an archive, a viable option around this is to disable the export in the bot, and export an ipa-file with a Post-integration script trigger. This can be uploaded to App Store Connect.

The script would look like this:

#!/bin/sh

/usr/bin/xcodebuild -exportArchive -archivePath ${XCS_ARCHIVE} -exportPath "${XCS_DERIVED_DATA_DIR}" -exportOptionsPlist ${XCS_SOURCE_DIR}/someconfdir/export.plist

/usr/bin/xcrun altool --upload-app --type ios --file "${XCS_DERIVED_DATA_DIR}/appname.ipa" --username "[email protected]" --password "xxx"

You need a way to make Xcode server have access to export.plist. One option is to check it in in with the source code, so the above script finds it in some configuration folder using the XCS_SOURCE_DIR variable.

It should look like this:

<?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>xxx</string>
    <key>method</key>
    <string>app-store</string>
    <key>uploadSymbols</key>
    <true/>
    <key>provisioningProfiles</key>
    <dict>
        <key>bundleid</key>
        <string>profilename</string>
    </dict>
</dict>
</plist>