Search code examples
iosxcodebuildxcrun

xcodebuild archive is failing when upgrading to ios 13


I am trying to use xcodebuild to create an ipa of my iOS app. These are the commands my script is running

xcodebuild build \
    -project AirQuality.xcodeproj \
    -scheme "Air Quality - Development" \
    -derivedDataPath /Users/gbreen/src/cuwcd/air-quality-ios/derivedData \
    -configuration "Development Release" SYMROOT=/Users/gbreen/src/cuwcd/air-quality-ios/build OBJROOT=/Users/gbreen/src/cuwcd/air-quality-ios/build DEPLOYMENT_LOCATION=YES | xcpretty
xcodebuild archive \
    -project AirQuality.xcodeproj \
    -scheme "Air Quality - Development" \
    -derivedDataPath /Users/gbreen/src/cuwcd/air-quality-ios/derivedData \
    -configuration "Development Release" SYMROOT=/Users/gbreen/src/cuwcd/air-quality-ios/build OBJROOT=/Users/gbreen/src/cuwcd/air-quality-ios/build DEPLOYMENT_LOCATION=YES \
     -archivePath /Users/gbreen/src/cuwcd/air-quality-ios/build/archive-Test/"Air Quality - Development".xcarchive \
     | xcpretty
xcrun xcodebuild \
     -exportArchive \
     -exportOptionsPlist /Users/gbreen/src/cuwcd/air-quality-ios/build/archive-Test/exportOptions-Test.plist \
     -archivePath /Users/gbreen/src/cuwcd/air-quality-ios/build/archive-Test/"Air Quality - Development".xcarchive \
     -exportPath /Users/gbreen/src/cuwcd/air-quality-ios/build/archive-Test

It works great when my app is targeting iOS 12 but when I move it to iOS 13 the xcrun command fails with a message:

error: archive at path '/Users/gbreen/src/cuwcd/air-quality-ios/build/archive-Test/Air Quality - Development.xcarchive' is malformed

Are there any specific considerations I need to make when updating to iOS 13? Do I need to configure something on my machine so xcrun knows it's an iOS 13 xcarchive? I just don't know where to go with this?


Solution

  • Through trial and error I figured out this same issue with my own build process. You need to take out the build flags:

    SYMROOT=...
    OBJROOT=...
    DSTROOT=...
    

    I don't entirely know why because I don't know the inner workings of xcodebuild and how it was updated for Xcode 11. So, I suspect the answer lies somewhere in : this long document.

    I hope that helps!