12

I have been using Dropbox Core API in my iOS app for quite a while now. After updating to Xcode 7 I received the following error when I try to compile my project:

ld: '.../Frameworks/Dropbox/iOS/DropboxSDK.framework/DropboxSDK' does not contain bitcode. 
You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated 
library from the vendor, or disable bitcode for this target. 

I know what Bitcode is and what it is good for. The error can be solved by simply setting the Enable Bitcode option to No in the targets Build Settings. After this everything compiles without any error and the app runs without any problem.

So far so good, but is this the "right" solution? I checked the Dropbox page for an updated Version of the SDK, but I already use the latest version.

The Project contains some other target for an App Widget, Watch Extension, etc. which do not use the Dropbox SDK. What option for Enable Bitcode should be used here? Is is (for some reason) better use the same value (Noin my case) for all targets? Does it make any sense to enable Bitcode for Watch and Widget targets if the the main app target does not use Bitcode?

What is the best practice here?

Andrei Herford
  • 17,570
  • 19
  • 91
  • 225
  • This has been [answered][1] comprehensively in a similar question. [1]: http://stackoverflow.com/questions/30722606/what-does-enable-bitcode-do-in-xcode-7 – Carl Sep 22 '15 at 10:39
  • @Carl Thanks, but the question/answer you linked basicly just describes what Bitcode is and what it is used for. This has almost nothing to do with my question here. As I said, I am well aware what Bitcode is and why this option is enabled in Xcode 7. As I said I know how to disable this option and after doing so, everything works fine. Question is: Is this the right solution? – Andrei Herford Sep 22 '15 at 11:52
  • I'd say you have the best solution available while you are still linking to Dropbox's library. You are preventing Apple from applying a subset of App optimisations that might deliver a fasting loading App (for example) but needs must. This will only become the "wrong" solution if Apple make Bitcode mandatory but one would hope that Dropbox will respond with an updated library in response. – Carl Sep 22 '15 at 13:01

2 Answers2

5

It seems that they have not released a bitcode supported API. Here is the link to the thread on the official Dropbox forums which includes a support person from Dropbox replying to other developers questions in this context.

Here is the relevant response from the Dropbox support person:

Oh, great! We haven't released an update to the iOS Core SDK with bitcode, but if you need bitcode support for the Core SDK, you can add the source directly, since it's open source. There's a thread about this for the Core SDK here: https://www.dropboxforum.com/hc/en-us/community/posts/204352929-Need-Bitcode-Framework

rgamber
  • 5,749
  • 10
  • 55
  • 99
  • 1
    For reference, there is now a new release of the Dropbox iOS Core SDK built with bitcode: https://www.dropbox.com/developers-v1/core/sdks/ios – Greg Apr 07 '16 at 20:00
2

Since I asked this question I simply set the option Enable Bitcode to No in the targets Build Settings while using Yes in the Widget and Apple Watch targets. That worked just fine and I did not notice any problems or limitations.

Now I tried to release a new version of my app to the App Store and I noticed a check box Include Bitcode when uploading the app file to Apple. When this check box is enabled I receive the following error:

Invalid Match-O Format. The Match-O bundle "MyApp.app/PlugIns/MyApp WatchKit Extension.appex" isn't consistent with the Match-O in the main bundle.

The main bundle Match-O contains armv7(machine code) and arm64(machine code), while the nested bundle Match-O contains armv7(bitcode and machine code) and arm64(bitcode and machine code).

Varify that all of the targets for a platform have a consistent value for the ENABLE_BITCODE build setting.

I have no idea why this is a problem now while all other version I uploaded during the last year passed without any problem. However the problem can easily be solved by un-checking the Include Bitcode check box. The upload is then accepted without any problem.

But there is a better solution: As Greg pointed out, Dropbox finally released a Bitcode enabled version of the SDK!

Download the new SDK 1.3.14, include it in your project and set ENABLE_BITCODE to Yes for all targets, and you are done. At least until Apple finds a new way to disturb your release workflow :-)

Andrei Herford
  • 17,570
  • 19
  • 91
  • 225