2

What I am trying to do:

I am trying to build a cocoapods framework in xcode11 and then use it in an iOS SDK.

What I have tried:

  • Set Enable Bitcode to yes
  • Before building the framework, I have set Other C flags to -fembed-bitcode and -fembed-bitcode-marker respectively for release and debug.

  • I have also set user defined build setting to BITCODE_GENERATION_MODE as bitcode and marker.

  • Build for both simulator and device; setting build scheme to release.

  • Follow this article to build a fat framework using lipo.

What issue I am facing:

After releasing the pre-release version of the framework to Cocoapods, I install it in my SDK. The build for SDK fails for device(release) with the following message:

ld: bitcode bundle could not be generated because '/Users/sourobratasarkar/Library/Developer/Xcode/DerivedData/Beaconstac-dpnhqvwchyqaeyavlbmfsntqlgnn/Build/Products/Release-iphoneos/EddystoneScanner/EddystoneScanner.framework/EddystoneScanner' was built without full bitcode. All frameworks and dylibs for bitcode must be generated from Xcode Archive or Install build file '/Users/sourobratasarkar/Library/Developer/Xcode/DerivedData/Beaconstac-dpnhqvwchyqaeyavlbmfsntqlgnn/Build/Products/Release-iphoneos/EddystoneScanner/EddystoneScanner.framework/EddystoneScanner' for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

It says the framework was built without full bitcode for architecture arm7.

Is there anything I am missing while building the framework? Using lipo -info I can see that arm7 architecture is present.

PS: The build succeeds for debug (both device and simulator) and release (simulator).

  • I have exactly the same problem... A solution would be great... – davidOhara Jan 23 '20 at 13:56
  • @davidOhara I found my solution here: https://stackoverflow.com/questions/54082111/compiled-framework-provides-bitcode-error-when-archiving – Sourobrata Sarkar Jan 24 '20 at 05:08
  • So you also managed to have a fat library, including simulator arch with bitcode enabled which is also able to be uploaded to the store? – davidOhara Jan 24 '20 at 07:49
  • I was able to add the fat framework to an SDK and use that in an app. I was able to archive the app. They was no build failures in simulator/device for both release and debug. – Sourobrata Sarkar Jan 24 '20 at 09:02
  • Ok, but its not possible to upload the app to the store, right?! I mean with Bitcode enabled and having also simulator arch inside it... – davidOhara Jan 24 '20 at 12:21

1 Answers1

3

Turns out there was no issue in the way I built the framework. Adding the following to the Podfile of the SDK where I was using the framework resolved this for me:

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