xcode7和ios9适配之路

从xcode6.x升级xcode7.2之后,发现要做一堆事情来做适配,不然之前的项目没法好好执行。

一.换库

dylib后缀的库都要换成tbd后缀的。例如以下所看到的

换库前:

换库后:



二.https问题

xcode7.2默认项目是使用https的。所以为了继续使用http。须要在info.plist中加入例如以下图所看到的:



三.Bitcode问题

真机測试时,发如今模拟器上没出错,真机出问题了,报了例如以下类似的问题:

‘/Users/**/Framework/SDKs/PolymerPay/Library/mobStat/lib**SDK.a(**ForSDK.o)’does not contain bitcode. You must rebuild it with bitcode enabled (Xcodesetting ENABLE_BITCODE), obtain an updated library from the vendor, or disablebitcode for this target. for architecture arm64


包括Bitcode字样,bitcode是被编译程序的一种中间形式的代码。

包括bitcode配置的程序将会在App store上被编译和链接。bitcode同意苹果在后期又一次优化程序的二进制文件,而不须要又一次提交一个新的版本号到App store上。

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

在上面的错误提示中,提到了怎样处理我们遇到的问题:

You must rebuild it with bitcode enabled(Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, ordisable bitcode for this target. for architecture arm64

要么让第三方库支持,要么关闭target的bitcode选项。

实际上,在Xcode 7中,我们新建一个iOS程序时,bitcode选项默认是设置为YES的。我们能够在”Build Settings”->”Enable Bitcode”选项中看到这个设置。只是。我们如今须要考虑的是三个平台:iOS,Mac OS,watchOS。

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

假设我们开启了bitcode,在提交包时,以下这个界面也会有个bitcode选项:


所以。假设我们的project须要支持bitcode。则必要要求全部引入的第三方库都支持bitcode。

否则,按下图所看到的关闭bitcode



三.白名单问题

升级到xcode7.2。假设项目有要跳转到其它app的,则须要在info.plist中加入相应app的Scheme,否则无法调用或跳转


<key>LSApplicationQueriesSchemes</key>
<array>
<string>iosamap</string>
<string>baidumap</string>
<string>seeyaa</string>
<string>wechat</string>
<string>weixin</string>
<string>sinaweibohd</string>
<string>sinaweibo</string>
<string>sinaweibosso</string>
<string>weibosdk</string>
<string>weibosdk2.5</string>
<string>mqqapi</string>
<string>mqq</string>
<string>mqqOpensdkSSoLogin</string>
<string>mqqconnect</string>
<string>mqqopensdkdataline</string>
<string>mqqopensdkgrouptribeshare</string>
<string>mqqopensdkfriend</string>
<string>mqqopensdkapi</string>
<string>mqqopensdkapiV2</string>
<string>mqqopensdkapiV3</string>
<string>mqzoneopensdk</string>
<string>wtloginmqq</string>
<string>wtloginmqq2</string>
<string>mqqwpa</string>
<string>mqzone</string>
<string>mqzonev2</string>
<string>mqzoneshare</string>
<string>wtloginqzone</string>
<string>mqzonewx</string>
<string>mqzoneopensdkapiV2</string>
<string>mqzoneopensdkapi19</string>
<string>mqzoneopensdkapi</string>
<string>mqzoneopensdk</string>
<string>alipay</string>
<string>alipayshare</string>
</array>


四.打包遇到问题

Failed to locate or generate matching signing assets
Xcode attempted to locate or generate matching signing assets and failed to do so because of the following issues.
Missing iOS Distribution signing identity for ... Xcode can request one for you.

截图例如以下

原因是Apple World Wide Developer Relations Certificate Authority的过期时间是2016年2月14。苹果的回答例如以下:

Thanks for bringing this to the attention of the community and apologies for the issues you’ve been having. This issue stems from having a copy of the expired WWDR Intermediate certificate in both your System and Login keychains. To resolve the issue, you should first download and install the newWWDR intermediate certificate (by double-clicking on the file). Next, in the Keychain Access application, select the System keychain. Make sure to select “Show Expired Certificates” in the View menu and then delete the expired version of the Apple Worldwide Developer Relations Certificate Authority Intermediate certificate (expired on February 14, 2016). Your certificates should now appear as valid in Keychain Access and be available to Xcode for submissions to the App Store.

简单的说就是颁发开发人员证书的根证书过期了。假设这个时候你打开keychain看你的公布证书会是这种:





就是这个Apple World Wide Developer Relations Certificate Authority过期了。所以这个颁发的证书都不能使用了。

如今来说下解决方式:
1.打开keychain(钥匙串),在登录和系统中找到过期的 Apple World Wide Developer Relation Certification Authority,然后删除它
注意在keychain显示菜单下,设置成显示过期证书




2.下载这个链接里的AppleWWDRCA.cer的证书到本地
3.记得要把系统钥匙串的设置权限打开


4.把AppleWWDRCA.cer安装到登录和系统中
设置成功后就能够了。查看下你的公布证书是否已经正常了。






參考链接:

http://jingyan.baidu.com/article/a3aad71ac4de98b1fb0096ac.html

http://www.jianshu.com/p/cda1790ea317?appinstall=0

http://www.jianshu.com/p/3e1b4e2d06c6

http://www.jianshu.com/p/a8cce94d508e




原文地址:https://www.cnblogs.com/jhcelue/p/7267282.html