I have made my own fat framework that I distribute over Cocoapods.
But when I try to upload an app with bitcode enabled using my framework, I am rejected with error ITMS-90635, see:
I want my framework to be compatible with bitcode, so I set ENABLE_BITCODE=YES
, BITCODE_GENERATION_MODE=bitcode
(also tried with OTHER_CFLAGS="-fembed-bitcode"
in addition) when building the framework.
Here is how I build my framework:
[...]
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}"
What I really do not understand is that my framework seems to have bitcode enabled, see:
Am I doing something wrong when building my framework?
Ok, I finally found what was wrong :)
Once lipo
done, I used to copy/paste
Build/Products/Release-iphoneos/MyFramework.framework/Modules/MyFramework.swiftmodule/
into
Build/Products/Release-iphonesimulator/MyFramework.framework/Modules/MyFramework.swiftmodule/
and then I was distributing this final framework:
Build/Products/Release-iphonesimulator/MyFramework.framework
.
Do the opposite! Once lipo
done, copy/paste MyFramework.swiftmodule/
's Release-iphonesimulator/
into the Release-iphoneos/
one and distribute the .framework in Release-iphoneos/
.