Tomasz Czura
Tomasz Czura

Reputation: 2434

iOS Framework on device bitcode not included

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?

Upvotes: 9

Views: 6669

Answers (4)

Umair Ali
Umair Ali

Reputation: 836

Add this code in your pod file, It will enable Bitcode for all the framework.

post_install do |installer|
  installer.pods_project.targets.each do |target|
      target.build_configurations.each do |config|
        config.build_settings['ENABLE_BITCODE'] = 'YES'
    end
  end
end

Upvotes: 0

Gabriel Goncalves
Gabriel Goncalves

Reputation: 5160

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

Upvotes: 5

Sohel L.
Sohel L.

Reputation: 9540

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

Upvotes: 1

Mukund Agarwal
Mukund Agarwal

Reputation: 585

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

Upvotes: 1

Related Questions