Xcode - Bitcode error only when running on device - ios

When running my app on simulator, it works perfectly, but when I try to run it on my device, I get the following error:
'/Users/xxxxxxxxx/Library/Developer/Xcode/DerivedData/Appname-dvsqmvczxjaaajfxojqecerjuauk/Build/Products/Debug-iphoneos/Amplitude-iOS/Amplitude_iOS.framework/Amplitude_iOS'
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. file
'/Users/xxxxxxxxx/Library/Developer/Xcode/DerivedData/APPNAME-dvsqmvczxjaaajfxojqecerjuauk/Build/Products/Debug-iphoneos/Amplitude-iOS/Amplitude_iOS.framework/Amplitude_iOS'
for architecture arm64
In both PROJECT and TARGET, I have changed the Enable Bitcode to Yes, inside the Build Options. I have also tried restarting my Mac and iPhone 14. I have also deleted everything in the Derived Data folder multiple times.
Any other ideas what might be the reason?

I solved this error by selecting pods and then bitcode to YES just like this.

I solved this by setting Enable Bitcode to No.

Related

Binary iOS framework archive error: bitcode bundle could not be generated because framework was built without full bitcode

I have created a binary iOS framework (framework with source obfuscated), and after jumping through hoops to get it to run, it gives an error on archive
bitcode bundle could not be generated because framework was built without full bitcode
bitcode bundle could not be generated because framework was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file -framework path- for architecture arm64
I set validate workspace to YES, and set the framework to sign & embed
I tried setting enable bitcode to NO and YES,
I tried setting skip install to YES and NO
I tried setting enable bitcode to yes and no, and I tried what this comment suggested:
https://stackoverflow.com/a/60265097/15266127
And I still have the same error. It's actually driving me insane.
This feels like I'm working through some dystopian level bureaucracy. Help me out here I'm suffering.

WebRTC' does not contain bitcode You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE)

My app works on the simulator when I run: npx react-native run-ios
However when I try to get the ipa file by 'Archive'-ing it via the .xcworkspace
I get the following error regarding WebRTC and bitcode.
How to fix this issue?
ld:
'/Users/bliss/Library/Developer/Xcode/DerivedData/DanceConnectyCube-czcpkmpwkpsbethjfvbfindeabwg/Build/Intermediates.noindex/ArchiveIntermediates/DanceConnectyCube/BuildProductsPath/Release-iphoneos/XCFrameworkIntermediates/react-native-webrtc/WebRTC.framework/WebRTC'
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. file
'/Users/bliss/Library/Developer/Xcode/DerivedData/DanceConnectyCube-czcpkmpwkpsbethjfvbfindeabwg/Build/Intermediates.noindex/ArchiveIntermediates/DanceConnectyCube/BuildProductsPath/Release-iphoneos/XCFrameworkIntermediates/react-native-webrtc/WebRTC.framework/WebRTC'
for architecture arm64 clang: error: linker command failed with exit
code 1 (use -v to see invocation)
you need to remove bitcode in your ios project setting in xcode target->build settings-> enable bitcode or use a custom webrtc build that enable it at compile time (huge build).
I made one here
edit:
a build with bitcode and swiftmodule support
This Repo also have sh script that explain the procedure.
For those came here with the same error:
If you are trying to debug your app in your iPhone you have to select bitcode=no in order to work.

Bitcode bundle could not be generated for arm64

I'm encountering a build error when I set 'Enable Bitcode' to 'YES' in the build settings of a project I'm currently working on. The error is:
ld: bitcode bundle could not be generated because '/Users/nick/Library/Developer/Xcode/DerivedData/PROJECTNAME-esksqmlmtpqewpbktcqeqloackeu/Build/Intermediates.noindex/PROJECT.build/Debug-iphoneos/PROJECTNAME.build/Objects-normal/arm64/main.o' was built without full bitcode. All object files and libraries for bitcode must be generated from Xcode Archive or Install build file '/Users/nick/Library/Developer/Xcode/DerivedData/PROJECTNAME-esksqmlmtpqewpbktcqeqloackeu/Build/Intermediates.noindex/PROJECT.build/Debug-iphoneos/PROJECTNAME.build/Objects-normal/arm64/main.o' for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
(I've redacted the project name to PROJECTNAME and a variant to PROJECT to post here.)
At first I though it could be due to one of the dependencies this project is using via Cocoapods but they all have 'Enable Bitcode' set to 'YES' and I'd expect to see the name of the offending library in the error message if that was the case. The project uses no frameworks other than those included via Cocoapods (and Apple frameworks).
I've tried deleting the derived data, restarting Xcode as well as clearing the build folder but the error persists.
I've also tried the '-fembed-bitcode-marker' solution as suggested for a similar problem here:
iOS library to BitCode
But I'm not building a static library but an app so perhaps unsurprising it made no difference.
The project is fairly large and has been developed since 2012 so includes Objective-C and Swift. It currently has iOS 8 as deployment target and 11.2 as base SDK. It's never had Bitcode enabled in any dev or production version in the past. We've got Bitcode enabled on similar but more recent projects. We're currently using Xcode 9.2 (9C40b).
I know I could set 'Enable Bitcode' to 'NO' for the project's build settings to 'fix' the error but I'd rather have bitcode enabled for the re-optimisations Apple can do once the binary is uploaded as mentioned here:
Apple Docs - App Thinning
Am I missing a flag in the build settings that fixes this error or perhaps something else? Any advice is much appreciated!
Many thanks,
Nick
After updating to Xcode 10 we tried to generate a Bitcode bundle again for this project and (after trying different build configs) have been able to do so. The config that eventually worked for this project was:
For the Project's and Pod's Build Settings:
'Enable Bitcode' set to 'YES'
Adding '-fembed-bitcode' to 'Other C Flags'
Adding 'BITCODE_GENERATION_MODE' with the value 'bitcode'
These settings were needed for Debug as well as Release. This is because Debug would throw the 'bitcode could not be generated' error (see original question) if we tried to use the '-fembed-bitcode-marker' or 'marker' flags.
We'd have preferred to use the 'marker' variants for Debug as it's quicker to compile but at least we now have something that works!

Xcode Bot bitcode error during integration only

ld: '/Library/Developer/XcodeServer/Integrations/Caches/5c17d3e903f4d302cf453 40fb301f30f/Source/ocular/Pods/Sodium/Sodium/libsodium- ios.a(libsodium_la-crypto_box.o)' 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. for architecture armv7
I ran /usr/local/bin/pod install before integration (Triggers).
I am able to build and run the app in simulator & real device. However my integration with bot failed with the above error message. I install Sodium via cocoapods.
I tried setting ENBALE_BITCODE = NO for project/targets/Pods
Server: 5.1.7
Xcode: 7.3.1
Any help is appreciated.
The error saying that you need to ENBALE_BITCODE = NO under your project target Change that and it will gonna work.
xCode -> your project -> Build Settings -> Enable Bitcode = NO .
After searching for the solutions online and the only solution i can find is Enable Bitcode = NO. Which is what i already had!
So eventually i use the WILD CARD SOLUTION which is to restart Xcode & Server - Still throws the same error. Since there's really no solution, i restarted my mac. First time still throws errors and TADA second time it works.I have no idea what have i done to make it work or what have i not done to make it work.
PS: I clean and clean build folder each time before i integrate my bot.
To anyone who faced the same issue: good luck

UrbanAirship iOS SDK error in Xcode 7 when archiving: libUAirship-6.2.0.a (UAWalletAction.o)' does not contain bitcode

I have an iOS application in Swift with CocoaPods using the UrbanAirship iOS SDK via Pods as follows:
pod 'UrbanAirship-iOS-SDK'
We can verify the version installed in the Podfile.lock file:
- UrbanAirship-iOS-SDK (6.2.0):
- UrbanAirship-iOS-SDK/Core (= 6.2.0)
- UrbanAirship-iOS-SDK/Core (6.2.0)
The application builds, runs and archives properly on Xcode 6.4. In addition, it also builds and runs properly on Xcode 7 beta 6. However, when archiving in Xcode 7, I get the following error:
ld: '.../Pods/UrbanAirship-iOS-SDK/Airship/libUAirship-6.2.0.a(UAWalletAction.o)' 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. for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)
I have updated the project build settings to disable bitcode by setting ENABLE_BITCODE to NO, both at the project and target(s) levels, as indicated on this SO answer, but the error persists.
Any help would be appreciated. Thanks for your time.
Yesterday I updated to the latest XCode7 (pre-release) and wasn't able to archive the project I was working on :( ... After struggling to build the UA SDK & other libraries myself, I simply set Enable Bitcode to NO and everything worked as it did in XCode6! :)
Update:
In addition to the project and targets in the project, Bitcode also should be disabled (by setting Enable Bitcode to No) in the CocoaPod framework targets affected (UrbanAirship-iOS-SDK in this case).
You can safely turn off Enabled Bitcode to NO if your app is not built for Watch OS.
I would also suggest using Xcode 6 to submit builds as most of the libraries won't be adding support for bitcode at least until the official Xcode 7 comes out.
Libraries with bitcode support cannot be run on Xcode 6, hence the delay in adoption.
To enable bitcode you have to build the library with Xcode 7. Xcode 7 GM was released today, so it is now possible for us to release an update to the UA SDK with bitcode enabled. Until the update, you can build the SDK from source by following https://github.com/urbanairship/ios-library.
Update:
We released 2 builds of 6.2.2, one with bitcode and one without. https://bintray.com/urbanairship/iOS/urbanairship-sdk/6.2.2/view

Resources