I'm trying to export an iOS app archive using xcodebuild
from Xcode 13.1, but the export is failing with the following exception:
$ xcodebuild -exportArchive -exportOptionsPlist exportPlist.plist -archivePath [REDACTED] -exportPath build/
2021-11-01 11:52:03.141 xcodebuild[2234:1268877] [MT] IDEDistribution: -[IDEDistributionLogging _createLoggingBundleAtPath:]: Created bundle at path "/var/folders/y0/9yktphk14bj_rfljxbhbd40c0000gn/T/[REDACTED]".
2021-11-01 11:52:34.646 xcodebuild[2234:1268877] -[NSNull path]: unrecognized selector sent to instance 0x7fff80701eb0
** INTERNAL ERROR: Uncaught exception **
Uncaught Exception: -[NSNull path]: unrecognized selector sent to instance 0x7fff80701eb0
Stack:
0 __exceptionPreprocess (in CoreFoundation)
1 objc_exception_throw (in libobjc.A.dylib)
2 -[NSObject(NSObject) __retain_OA] (in CoreFoundation)
3 ___forwarding___ (in CoreFoundation)
4 _CF_forwarding_prep_0 (in CoreFoundation)
5 -[IDEDistributionProcessingPipeline process:] (in IDEFoundation)
6 -[IDEDistributionPackagingStep loadFromExportOptions:error:] (in IDEFoundation)
7 -[IDEDistributionDriver runWithDestinationPath:error:] (in IDEFoundation)
8 -[Xcode3CommandLineBuildTool _distributeArchiveAndExit] (in Xcode3Core)
9 -[Xcode3CommandLineBuildTool run] (in Xcode3Core)
10 main (in xcodebuild)
11 start (in libdyld.dylib)
[1] 2234 abort xcodebuild -exportArchive -exportOptionsPlist fastlane/exportPlist.plist
The bug was introduced in our project because one of our dependencies is not ready to use bitcode. Disabling bitcode on Xcode was solving the issue, but using the xcodebuild
command was not, because we tried using an export options plist file generated by Fastlane, which seems to be defective.
Be sure to disable bitcode when exporting your archived build. If you're using xcodebuild
ensure your export options plist includes the following entry:
<key>compileBitcode</key>
<false/>
If you're using Fastlane, the include_bitcode: false
argument seems to have no effect in the final export options plist generated by Fastlane. Instead use the following argument on gym/build_ios_app:
export_options: {
compileBitcode: false,
}
Please refer to this issue in the Fastlane repository, if necessary: https://github.com/fastlane/fastlane/issues/19550