iOS开发:在开发中用真机运行项目报错bitcode的解决方法

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/CC1991_/article/details/82493033

    在iOS开发中,难免会导入第三方的库,可是在进行真机测试的时候,会报错clang: error: linker command failed with exit code 1 (use -v to see invocation),错误详细信息如下:
    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 arm64.

    这个错误的原因是,因为新建的项目默认是打开了bitcode的设置,也就是bitcode的设置为YES,这些编译失败的原因是链接了第三方二进制的库或者框架,而这些框架或者库内没有包含bitcode的中间代码,从而导致项目编译失败。
    解决方法: 
    打开项目工程,找到Build Settings->Enable Bitcode由YES设置为NO,即可。
    具体图示如下所示:

    苹果官方对于bit code给的定义:
    Bitcode is an intermediate representation of a compiled program. Apps you upload to iTunes Connect that contain bitcode will be compiled and linked on the App Store. Including bitcode will allow Apple to re-optimize your app binary in the future without the need to submit a new version of your app to the store.
    介绍的是bitcode是被编译程序的一种中间形式的代码,包含bitcode配置的程序将会在App store上被编译和链接。bitcode允许苹果在后期重新优化程序的二进制文件,而不需要重新提交一个新的版本到App store上。
    通过上述方法即可解决这个问题。
    


    以上就是本章全部内容,欢迎关注三掌柜的微信公众号,欢迎关注!

猜你喜欢

转载自blog.csdn.net/CC1991_/article/details/82493033
今日推荐