從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
在上面的錯誤提示中,提到了如何處理我們遇到的問題:
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,否則無法調用或跳轉
四.打包遇到問題
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顯示菜單下,設置成顯示過期證書