Search code examples
iosswifttesseract

iOS -weak_library and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together


I wanted to use Tesseract for my project. I have created a new project , added Tesseract to my pod file. pod install correctly and my project build perfectly on Emulator device. But on real device the following error occured. Don't know what's going on ld: -weak_library and -bitcode_bundle (Xcode setting ENABLE_BITCODE=YES) cannot be used together clang: error: linker command failed with exit code 1 (use -v to see invocation)


Solution

  • Reason of Problem : While installing cocoapod dependency that were compiled with ENABLED_BITCODE = YES and thus it override this settings that create a problem. To solve this , we had to add these lines on our cocoapod so that ENABLED_BITCODEsetting is not overriden during cocoapod dependency installation

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