升级Xcode7问题

来源:互联网 发布:网上打工软件 编辑:程序博客网 时间:2024/05/23 19:32
##Bitcode
***


在Xcode7下,运行我们的旧项目出现编译不过的问题,报错类似如下:


> ld: ‘/Users/XXX/Framework/SDKs/PolymerPay/Library/mobStat/XXXXSDK’ does not contain bitcode. 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 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上。




在 What’s New in Xcode-New Features in Xcode 7中,又有如下描述:


> **Bitcode.** When you archive for submission to the App Store, Xcode compiles your app into an intermediate representation. The App Store then compiles the bitcode down into the 64- or 32-bit executables as necessary.


当我们提交程序到App store上时,Xcode会将程序编译为一个中间表现形式(bitcode)。然后App store会再将这个botcode编译为可执行的64位或32位程序。


那问题应该如何解决呢?


根据错误信息提示,要么让你引入第三方库支持bitcode,要么关闭工程的bitcode。


不过,我们现在需要考虑的是三个平台:iOS,Mac OS,watchOS。


* 对应iOS,bitcode是可选的。
* 对于watchOS,bitcode是必须的。
* Mac OS不支持bitcode。


对于第三方库暂时无法支持bitcode,解决办法就是关闭工程的bitcode


**在TARGETS -> Build Settings中搜素bitcode,将Enable Bitcode选项改为NO。**




##HTTP://
***
在iOS9中,苹果将原http协议改成了https协议,使用 TLS1.2 SSL加密请求数据。


在使用到http的地方会报错如下:


> App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file.


解决办法是在info.plist中添加如下字段


<key>NSAppTransportSecurity</key><dict>
    <key>NSAllowsArbitraryLoads</key>
    <YES></dict>


效果如下图:



##插件


Xcode的升级都会带来之前的插件都是失效,解决办法仅需一行代码:


1. 退出Xcode
2. 打开MAC系统上的Terminal(终端)程序
3. 将下列的命令复制后粘贴上去:


find ~/Library/Application\ Support/Developer/Shared/Xcode/Plug-ins -name Info.plist -maxdepth 3 | xargs -I{} defaults write {} DVTPlugInCompatibilityUUIDs -array-add `defaults read /Applications/Xcode.app/Contents/Info.plist DVTPlugInCompatibilityUUID`


4. 按回车键,重新打开Xcode,测试插件是否可用


欢迎订阅微信公众号iOSTalk,谈编程,分享iOS。



0 0