I am trying to build a new bitcode-enabled tvOS framework whose details are as follows:
Language used in Framework: Swift 3.0
Type of Library: XYZ.framework
Is it a Universal build (supporting both Simulator and Device)?: YES
tvOS Deployment Target: 9.2 onwards
I am building the framework from a script using xcodebuild command as per the following steps:
1. Making a device build using the following command in script.
xcodebuild -target "${FRAMEWORK_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -arch arm64 ENABLE_BITCODE=YES OTHER_CFLAGS="-fembed-bitcode" -sdk appletvos
2. Making a Simulator build using the following command in script.
xcodebuild -target "${FRAMEWORK_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -arch x86_64 ENABLE_BITCODE=YES OTHER_CFLAGS="-fembed-bitcode-marker" -sdk appletvsimulator
3. Making a Universal build using the following lipo command
lipo -create -output "${UNIVERSAL_FRAMEWORK}/${FRAMEWORK_NAME}" "${CONFIG_DEVICE_DIR}/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}" "${CONFIG_SIMULATOR_DIR}/${FRAMEWORK_NAME}.framework/${FRAMEWORK_NAME}"
All the above 3 commands are executed successfully and an Universal framework is being built without any issues. But, when I try to verify if the final framework is bitcode enabled or not using the following commands, I am not getting any results.
otool -l tvOSFramework.framework/tvOSFramework | grep __bitcode (or)
otool -l tvOSFramework.framework/tvOSFramework | grep __LLVM
When I try to include this framework in an application and try to archive the application (AppName: TestAppObjC written in Obj C) using XCode, archiving fails with the following error:
Failed to verify bitcode in tvOSFramework.framework/tvOSFramework:
error: Cannot extract bundle from /var/folders/9f/9sgckkbn7xx61p6m25kh80kc0000gn/T/IDEDistributionThinningStep.XFm/Payload/TestAppObjC.app/Frameworks/tvOSFramework.framework/tvOSFramework (x86_64)
I had tried with setting BITCODE_GENERATION_MODE=bitcode also but the same issue occurs.
Hence, I finally ended up in having two different versions of the framework one for device and one for the Simulator. But I would like to have an Universal framework instead with bitcode enabled.
Can anybody let me know if there is a way to arrive at a bitcode enabled Universal Swift framework for tvOS?