9

I am developing static library for iOS, in which I am using Alamofire. When I try to build for release for simulator, everything is ok, however when I try to build it for device (release or debug) I get following problem:

ld: bitcode bundle could not be generated because '/PathToMyLibraryProducts/Release-iphoneos/Alamofire/Alamofire.framework/Alamofire' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build for architecture armv7

My framework has enabled bitcode, and it is fat framework (build for device and simulator). How can I resolve that?

Tomasz Czura
  • 2,174
  • 10
  • 18

3 Answers3

4

If you are using cocoapods-binary with cocoapods

This error will appear since cocoapods-binary won't generate frameworks with bitcode enabled unless you specifically indicate that by using this key in your Podfile:

enable_bitcode_for_prebuilt_frameworks

This is how your Podfile will look:

plugin 'cocoapods-binary'

platform :ios, '12.0'
use_frameworks!
enable_bitcode_for_prebuilt_frameworks!
all_binary!

target 'ProjectName' do
    pod 'Alamofire'
end

Community
  • 1
  • 1
Gabriel Goncalves
  • 4,902
  • 3
  • 22
  • 33
1

Found this discussion which may be relevant

In summary the following setting is needed: BITCODE_GENERATION_MODE=bitcode for Release builds and BITCODE_GENERATION_MODE=marker for Debug builds

Hope that helps.

Kind regards, Mukund

Community
  • 1
  • 1
Mukund Agarwal
  • 537
  • 5
  • 14
0

I think, bitcode is not enabled while you are building for Generic Device. So do the following:

  1. Under pods.xcodeproj, select all pods target.
  2. Navigate under Build Settings and make sure that all your "Pods" > "Build Settings" > "Build Active Architecture Only" is set to "NO".
  3. Enable Bitcode set to YES
  4. Then, tap on project target, and follow the Step 2 and 3
  5. Clean the build and make Archive
Sohil R. Memon
  • 8,982
  • 1
  • 28
  • 56
  • After that, when Archive i get `ld: -reexport_framework and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together`. No changes for run on device. – Tomasz Czura Apr 06 '17 at 11:18
  • Have you clean the build? and also delete DeviredData folder too. – Sohil R. Memon Apr 06 '17 at 11:33
  • 1
    Ok, I am able to archive app which is using my framework. But I am still not able to run it on device and can not generate fat library – Tomasz Czura Apr 06 '17 at 12:10
  • What error are you receiving while running on device? – Sohil R. Memon Apr 06 '17 at 12:30
  • The same I mentioned in answer - `ld: bitcode bundle could not be generated because '/PathToMyLibraryProducts/Release-iphoneos/Alamofire/Alamofire.framework/Alamofire' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build for architecture armv64` – Tomasz Czura Apr 06 '17 at 12:35
  • Please check this SO thread: http://stackoverflow.com/questions/31233395/ios-library-to-bitcode – Sohil R. Memon Apr 06 '17 at 12:56
  • http://stackoverflow.com/questions/34666247/bitcode-bundle-could-not-be-generated-because-ios-charts – Sohil R. Memon Apr 06 '17 at 12:56
  • already tried this, and also tried this https://medium.com/@heitorburger/static-libraries-frameworks-and-bitcode-6d8f784478a9 - nothing changed. Still can not run app on device – Tomasz Czura Apr 06 '17 at 13:38
  • @TomaszCzura, Were you able to resolve the issue, if yes can you share the solution? I am facing the same issue. Did go through all the links mentioned but failed. – Shailendra Suriyal Jan 05 '18 at 20:35
  • Did you solved it?? It is nightmare for us and it is real issue... Cant solve for 5 days – Viktor Vostrikov Jan 08 '19 at 12:07