Search code examples
xcodewatchosbitcode

Enable bitcode build option missing from target


My project has 2 targets, one for iOS and the other for watchOS.
In the project Build Settings under Build Options, I have set „Enable Bitcode“ to YES.
In the iOS target, „Enable Bitcode“ is also set to YES.
The watchOS target, however, does not have the „Enable Bitcode“ option.

When I archive my project and submit it to iTunesConnect, it is rejected, and I get an email mentioning two errors:

1st error:
Invalid Bundle Executable - The executable file xxxxx contains incomplete bitcode. To compile binaries with complete bitcode, open Xcode and choose Archive in the Product menu.

2nd error:
Invalid Segment Alignment - The app binary at xxxxx does not have proper segment alignment. Try rebuilding the app with the latest Xcode version.

To the 1st error:
xxxxx is my watchOS target where I do not have the option to enable bitcode.

To the 2nd error:
I have the latest Xcode version.

Any suggestions?

EDIT:
It is possible to set the missing "Enable bitcode" option as a user defined flag (ENABLE_BITCODE = YES) in the build settings of the target. However, the error remains the same...


Solution

  • Two things were required to remedy the errors:

    Apparently, Xcode 9.2 has only for iOS targets the build setting Enable Bitcode under Build Options. Watch Extension targets require a User-Defined build setting ENABLE_BITCODE set to YES.

    Additionally, I had wrong paths in my workspace.
    My workspace contains 2 projects, each one with an iOS and a watchOS target. The 1st project is my app, and the 2nd project is my framework used by the app.
    Apple Developer Technical Support suggested to deleted all references of my app to the framework in the project navigator of Xcode, and then to add back the frameworks for both app targets under General/Embedded Binaries.

    This allowed my to create a valid archive that could be submitted to the App Store and was accepted.