My Widget Extension will not build with Bitcode

I have just updated my iMac to an M1 and now one of my projects is giving me these warnings for 3 of the libraries embedded in a Widget Extension:

ld: warning: all bitcode will be dropped because '/Users/..../DJSwiftHelpers_Extension' was built without 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 understand that the app needs all libraries to be built with bitcode in order to be bitcode compatible.

2 of the libraries are my own, one in fact is actually built inside the same project and all have bitcode enabled.

The libraries have 2 versions, 1 with "Allow app extension safe API only" and the other without. It's only the app extension libraries that are an issue.

Those embedded in a Watch extension are fine. Those embedded in Intents are fine. It's just the Widget extension that complains so I don't think the issue is the Frameworks.

I can clear the warnings by disabling bitcode for the Widget Extension, however on uploading the app to the App Store, bitcode is in fact disabled for the whole app.

So I guess my questions are:

Why has this only become an issue on an M1 mac and not on my Intel Mac?

Can widget extensions support bitcode? Or is the bitcode setting just ignored?

Is it really impossible to use bitcode when providing a Widget Extension?

  • Ok, it seems this only happens when building for the simulator. Which isn't really an issue. When I archive the app, it builds with bitcode just fine.

  • We are also experiencing this issue when building with xcframeworks on an M1 Mac. Bitcode is enabled for the modules within the SDK that we are testing with. We are not able to replicate this issue on an Intel Mac.

    By default, Xcode sets ENABLE_BITCODE to YES. We are able to consistently reproduce this issue, if we toggle this setting to NO and back to YES.

    Steps to reproduce:

    Clone the braintree_ios repo and build the Demo appToggle Demo Xcode project ENABLE_BITCODE Build Setting to NOBuild the projectToggle back to YESBuild the projectSee warnings similar to the ones posted above

    When we ran the sample app on a device, these warnings/errors went away. We were also able to archive successfully.  There appears to be a Swift bug report about this also.

Add a Comment

Replies

We are also experiencing this issue when building with xcframeworks on an M1 Mac. Bitcode is enabled for the modules within the SDK that we are testing with. We are not able to replicate this issue on an Intel Mac.

By default, Xcode sets ENABLE_BITCODE to YES. We are able to consistently reproduce this issue, if we toggle this setting to NO and back to YES.

Steps to reproduce:

  1. Clone the braintree_ios repo and build the Demo app
  2. Toggle Demo Xcode project ENABLE_BITCODE Build Setting to NO
  3. Build the project
  4. Toggle back to YES
  5. Build the project
  6. See warnings similar to the ones posted above

When we ran the sample app on a device, these warnings/errors went away. We were also able to archive successfully.  There appears to be a Swift bug report about this also.