iOS 应用分发失败,出现错误 ITMS-90635 嵌套包包含 arm64(机器代码),而主包包含 arm64(位码)

iOS app distribution failed with error ITMS-90635 nested bundle contains arm64(machine code) whereas main bundle contains arm64(bitcode)

我已经制作了我自己的 fat 框架并分发到 Cocoapods 上。

但是当我尝试使用我的框架上传启用了位码的应用程序时,我被拒绝并出现错误 ITMS-90635,请参阅:

我希望我的框架兼容bitcode,所以我在构建框架时设置了ENABLE_BITCODE=YESBITCODE_GENERATION_MODE=bitcode(另外还尝试了OTHER_CFLAGS="-fembed-bitcode"

以下是我构建框架的方式:

[...]

echo "Clean ${TARGET_NAME} for simulator"
xcodebuild -workspace ${WORKSPACE_NAME}.xcworkspace -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -scheme ${SCHEME} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode clean

echo "Clean ${TARGET_NAME} for generic device"
xcodebuild -workspace ${WORKSPACE_NAME}.xcworkspace -configuration ${CONFIGURATION} -destination generic/platform=iOS -scheme ${SCHEME} CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode clean

echo "Build ${WORKSPACE_NAME} for simulator"
xcrun xcodebuild -workspace ${WORKSPACE_NAME}.xcworkspace -scheme ${SCHEME} -configuration ${CONFIGURATION} -destination 'platform=iOS Simulator,name=iPhone 6,OS=latest' -sdk iphonesimulator CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode

echo "Build ${WORKSPACE_NAME} for generic device"
xcrun xcodebuild -workspace ${WORKSPACE_NAME}.xcworkspace -scheme ${SCHEME} -configuration ${CONFIGURATION} -destination generic/platform=iOS -sdk iphoneos CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO ENABLE_BITCODE=YES BITCODE_GENERATION_MODE=bitcode

[...]

lipo -create "${DEVICE_BIN}/${TARGET_NAME}" "${SIMULATOR_BIN}/${TARGET_NAME}" -output  "${UNIVERSAL_PATH}/${TARGET_NAME}.framework/${TARGET_NAME}"

我很不明白的是我的框架好像启用了bitcode,见:

我在构建框架时做错了什么吗?

好的,我终于找到问题所在了:)

lipo 完成后,我曾经 copy/paste

Build/Products/Release-iphoneos/MyFramework.framework/Modules/MyFramework.swiftmodule/

进入

Build/Products/Release-iphonesimulator/MyFramework.framework/Modules/MyFramework.swiftmodule/

然后我分发了这个最终框架:

Build/Products/Release-iphonesimulator/MyFramework.framework.

反其道而行之!一旦 lipo 完成,copy/paste MyFramework.swiftmodule/Release-iphonesimulator/ 进入 Release-iphoneos/ 并在 Release-iphoneos/.

中分发 .framework