4

I'm currently building an Umbrella framework (before anyone say so, I know this is discouraged by Apple, but I am in the case were I'm the owner of all the sub-frameworks, they are not distributed if they are not part of this or another Umbrella framework I may create, and we are in a closed source configuration) within Xcode 8.

I've followed this post to create the framework: https://stackoverflow.com/a/41815368/2572568

Everything is working fine except that I got the following error:

dyld: Library not loaded: @rpath/B.framework/B Referenced from: /private/var/containers/Bundle/Application/E0113060-CA91-47F8-BEE3-BDF1F847DB3A/app.app/Frameworks/A.framework/A Reason: no suitable image found. Did find: /private/var/containers/Bundle/Application/E0113060-CA91-47F8-BEE3-BDF1F847DB3A/app.app/Frameworks/A.framework/Frameworks/B.framework/B: required code signature missing for '/private/var/containers/Bundle/Application/E0113060-CA91-47F8-BEE3-BDF1F847DB3A/app.app/Frameworks/A.framework/Frameworks/B.framework/B'

app is the Application using the Umbrella framework A which has a sub-framework B

I found that disabling bitcode from all the projects is solving this issue (and that's what I am doing now) from this thread : https://github.com/CocoaPods/CocoaPods/issues/3661

So here are my questions:

  1. What does disabling bitcode is exactly doing ? I found that Apple can run optimization after you submitted your code. Are these speed optimization or disk space optimization, or any other optimization ?
  2. Am I doing something wrong building my Umbrella framework ? Is it possible not to disable bitcode ?
Community
  • 1
  • 1
Supermomo
  • 81
  • 6

2 Answers2

1

First of all: I came into the exact same problem today and I couldn't fix it. But removing Bitcode fixt it for me. Thanks for that

To your questions:

  1. Bitcode is something kind of similar to Java's Bytecode. Your app gets compiled completely, but not in machine code (like assembler). Your app is compiled to Bitcode. This helps Apple to build different versions of your app on their server. One for 64bit and one for 32bit devices. Then they separate both apps, which saves disk space on the actual device. And they probably have some further optimisations, which could speed up the app. Generally it's not needed today.

  2. I tried almost everything I could imagine and at the moment I would say: No it's not possible to disable bitcode, if you have a big umbrella framework. Can you check if you have sub-frameworks in your umbrella framework which do not support Bitcode ? Like AWS SDK, Facebook SDK... It may be possible to support Bitcode if all sub-frameworks support Bitcode. This answer seems promising me, but it's a bit old: https://stackoverflow.com/a/27638841/1203713

Regards, Alex

Community
  • 1
  • 1
Sn0wfreeze
  • 1,959
  • 3
  • 18
  • 32
  • Thanks Alex for this answer. I am currently only wrapping frameworks I am the owner inside this umbrella framework, so I assume they all would support bitcode (except if I need to do something special for this). Anyway, based on your answer 1, maybe bitcode cannot be enabled because of the structure of the Umbrella framework, making it impossible to be compiled in bitcode. – Supermomo Feb 08 '17 at 07:58
  • 1
    It's not completely clear how Bitcode works, so probably that could make sense and be another reason why Apple does not like Umbrella Frameworks – Sn0wfreeze Feb 08 '17 at 08:29
1

Ok so after a few more researches on completely unrelated questions, I found this thread : https://github.com/Carthage/Carthage/issues/535

In substance, this solve question 2 and another one : Yes, you can enable bitcode for your Umbrella framework.

To do so, you must manually set a User-defined setting (inside Build settings, click on the plus in the top bar) named BITCODE_GENERATION_MODE to bitcode. This will force Xcode to build you project with real bitcode and not only a bitcode subset. User_Defined_Field bitcode You have to set this flag for all the frameworks under your Umbrella framework.

Supermomo
  • 81
  • 6