IOS9.0升級後以及xcode7後引發的問題

1、iOS9 bitcode致使編譯不經過的問題

先來講說bitcode,這究竟是什麼龜ios

官方文檔App Distribution Guide–App Thinning (iOS, watchOS)一節中,有這樣一個定義:Bitcode is an intermediate representationof a compiled program. Apps you upload to iTunes Connect that contain bitcodewill be compiled and linked on the App Store. Including bitcode will allowApple to re-optimize your app binary in the future without the need to submit anew version of your app to the store.xcode

說的是bitcode是被編譯程序的一種中間形式的代碼。包含bitcode配置的程序將會在App store上被編譯和連接。bitcode容許蘋果在後期從新優化程序的二進制文件,而不須要從新提交一個新的版本到App store上。安全

而在What’s New in Xcode-New Features in Xcode 7中,還有一段以下的描述:服務器

Bitcode. When you archive for submission tothe App Store, Xcode will compile your app into an intermediate representation.The App Store will then compile the bitcode down into the 64 or 32 bitexecutables as necessary.微信

當提交程序到App store上時,Xcode會將程序編譯爲一箇中間表現形式(bitcode)。而後App store會再將這個botcode編譯爲可執行的64位或32位程序。網絡

從中咱們能夠看出其與包的優化有關了。app

如今最大的問題就是xcode7,xcode7默認是打開bitcode的,咱們的工程若是採用了別人封裝的第三方庫,那麼好了,就會出現相似如下的錯誤
ld: ‘///某某第三方庫’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。這時候若是要解決編譯不經過的問題,要麼讓第三方庫支持,要麼關閉target的bitcode選項。
框架

在Xcode 7中,咱們新建一個iOS程序時,bitcode選項默認是設置爲YES的。咱們能夠在」Build Settings」->」Enable Bitcode」選項中看到這個設置。將其設置爲NO就好了。如今蘋果給出的臨時解決方案就比如當初MRC和ARC時候的解決辦法,當初xcode5更新時候默認是工程建立是ARC的,你能夠關閉ARC改成MRC,通過了一段時間後,你們都開始使用了ARC,那麼bitcode也同樣。ide

不過,咱們如今須要考慮的是三個平臺:iOS,Mac OS,watchOS。微信支付

對於iOS,bitcode是可選的;對於watchOS,bitcode是必須的;而Mac OS是不支持bitcode。

若是咱們開啓了bitcode,在提交包時,下面這個界面也會有個bitcode選項:



因此,若是咱們的工程須要支持bitcode,則必要要求全部引入的第三方庫都支持bitcode。

2、 iOS9 HTTP 不能正常使用的解決辦法

iOS9把全部的http請求都改成https了:iOS9系統發送的網絡請求將統一使用TLS 1.2 SSL。採用TLS 1.2 協議,目的是 強制加強數據訪問安全,並且 系統 Foundation 框架下的相關網絡請求,將再也不默認使用 Http 等不安全的網絡協議,而默認採用 TLS 1.2。服務器所以須要更新,以解析相關數據。如不更新,可經過在 Info.plist 中聲明,倒退回不安全的網絡請求。

解決的方法能夠在Info.plist中添加NSAppTransportSecurity類型Dictionary。 在NSAppTransportSecurity下添加NSAllowsArbitraryLoads類型Boolean,值設爲YES

3、iOS 9 使用URL scheme必須將其加入白名單

ios9須要將要使用的URL Schemes設置爲白名單:如微信支付寶等,須要在plist文件中添加以下代碼

<key>LSApplicationQueriesSchemes</key>

    <array>

        <string>alipay</string>

        <string>wechat</string>

        <string>weixin</string>

    </array>

4、iOS 9 以後sdk中庫名修改

ios9 中.dylib後綴的庫更改成.tbd

相關文章
相關標籤/搜索