Bitcode warning when Swift package is used in watch app

Given an iOS app with a watch app and the watch app has bitcode explicitly enabled with ENABLE_BITCODE=YES.

When a swift package is used in the watch target, building the iOS app against a simulator gives the following bitwcode warning in the Built target SampleWatchApp Extension: Link SampleWatchApp Extension (arm64) step. (Building against a physical device does not lead to this warning.)

ld: warning: all bitcode will be dropped because '/Users/username/Library/Developer/Xcode/DerivedData/SampleApp-egrqmpcsrjdhaxfjdiwqjeljghpq/Build/Products/Debug-watchsimulator/LocalSwiftPackage.o' 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.

This does not make sense to me because AFAIK Swift Packages have bitcode enabled by default.

I created a simple sample project which shows this issue. There the local swift Package only contains the default "Hello World" code, so I do not see where there could be an issue.

  • Do Swift packages not support bitcode for watchOS simulators or am I missing something else?
  • How can this warning be resolved?
  • Or is this a bug in the context of Swift Packages and bitcode in watchOS targets?

It turned out that the root cause was explicitly setting ENABLE_BITCODE=YES in the watchOS extension target. This applies bitcode to all builds whereas with the default setting, bitcode is only selectively applied by Xcode. So sticking to the default value solved the issue.

Terms of Service

Privacy Policy

Cookie Policy