xcode7和ios9适配之路

来源:互联网 发布:上网控制软件破解版 编辑:程序博客网 时间:2024/05/16 05:08

从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选项:


所以,如果我们的工程需要支持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




1 0
原创粉丝点击