The data couldn't be read because it isn't in the correct format when running xcodebuild

Viewed 89

I'm trying to build an IPA using xcodebuild, but I get an error saying that "the data could't be read because it isn't in the correct format.". This only happens when running it from fastlane, even if the command that runs is exactly the same as if I run it from the command line. I.e. this works when called from the command line:

/usr/bin/arch -arm64e xcrun xcodebuild -exportArchive -allowProvisioningDeviceRegistration -allowProvisioningUpdates -archivePath /Absolute/Path/To/Project/build/ios/archive/Runner.xcarchive -exportPath /Absolute/Path/To/Project/build/ios/ipa -exportOptionsPlist /Absolute/Path/To/Project/ios/AdHocExportOptions.plist

But it doesn't work when called from within fastlane:

lane :test_build do
        sh("/usr/bin/arch -arm64e xcrun xcodebuild -exportArchive -allowProvisioningDeviceRegistration -allowProvisioningUpdates -archivePath /Absolute/Path/To/Project/build/ios/archive/Runner.xcarchive -exportPath /Absolute/Path/To/Project/build/ios/ipa -exportOptionsPlist /Absolute/Path/To/Project/ios/AdHocExportOptions.plist")
end

The command also seems to work fine without -exportArchive and -exportOptionsPlist.

Does anyone know what might cause the command to fail in fastlane, but not on the command line? I have tested it both on my M1 Mac mini, as well as in a GitHub action, but the result is the same.

I should also note that I have created an issue about the problem a while ago as well, however that is still open: https://github.com/fastlane/fastlane/issues/20253

0 Answers
Related