Search code examples
iosobjective-cllvmbitcodeios-universal-framework

Creating iOS universal framework with Xcode 9


I am creating universal framework for iOS. I am trying to create one through lipo and it does create a universal one

I check the architecture with lipo after creation it returns me correct: Architectures in the fat file: i386 x86_64 armv7 arm64

I run the application on phone and simulator that works fine as well.. But when I try to export the .ipa from xcarchive I get the following error:

Failed to verify bitcode in Myframework.framework/Myframework:\nerror: Platform iPhoneSimulator is not supported\n\n

Also I can the bitcode symbols in my universal framework running

otool -l /Path/To/Framework | grep __LLVM

  segname __LLVM

   segname __LLVM

If I choose only iphoneos framework that works fine


Solution

  • You need to strip i386 and x86_64 from the framework before exporting the archive.

    e.g. $ lipo -remove i386 ./path/to/binary_name -o ./path/to/binary_name $ lipo -remove x86_64 ./path/to/binary_name -o ./path/to/binary_name

    You need to do this, since i386 and x86_64 are not supported for export -- "Platform iPhoneSimulator is not supported"