1

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

Nirav Kotecha
  • 2,493
  • 1
  • 12
  • 26
hariszaman
  • 8,202
  • 2
  • 40
  • 59
  • Hi hariszaman, check this repo for an alternative https://github.com/gurhub/universal-framework. Best – MGY Aug 05 '20 at 11:58
  • 1
    Hi hariszaman, for 2020 solution please check this repository: https://github.com/gurhub/surmagic. Best – MGY Nov 20 '20 at 06:34

1 Answers1

2

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"

greymouser
  • 3,133
  • 19
  • 22
  • you mean before exporting archive of the application? Is this a general practise to do that? – hariszaman Oct 13 '17 at 13:37
  • @hariszaman Yes, you cannot ship iPhoneSimulator binaries to the App Store. Internally, you can use them all you want. – greymouser Oct 13 '17 at 13:42
  • So does that mean that each third party framework which we use inside the application and is a fat binary we need to remove simulator architectures from that? – hariszaman Oct 13 '17 at 14:22
  • @StanislavPankevich is that IMPORTANT DETAIL in the linked question still valid? – hariszaman Oct 13 '17 at 14:28
  • @hariszaman it is hard to say this without trying to submit them to app store. The last time I checked this was mid of 2016 and it was still the case. Keep in mind that IMPORTANT DETAIL only applies to dynamic frameworks. – Stanislav Pankevich Oct 13 '17 at 14:30
  • the one I created is a dynamic library – hariszaman Oct 13 '17 at 14:31
  • To answer you question specifically: `So does that mean that each third party framework which we use inside the application and is a fat binary we need to remove simulator architectures from that? – hariszaman 1 hour ago` until someone confirms the opposite, yes, each and every dynamic framework has to be stripped off from simulator slices. Yes, it is stupid but that's state of the art. See my linked answer: Realm and Carthage have the scripts that do this for in bulk. – Stanislav Pankevich Oct 13 '17 at 15:33
  • @hariszaman Yes, you must prune i386 and x86_64 from all frameworks that you intend to export. – greymouser Oct 13 '17 at 16:01