標籤:
在新發布的iOS9系統上圍繞使用者資料的安全性和體驗新增了一些安全特性,同時也影響了應用的實現以及整合方式,為了保證良好的穩定性和體驗,需要做如下處理: (ps.由於目前QQ SDK官方並未給出明確的白名單,故QQ相關白名單可能並不夠完善,我們會不斷進行補充,也歡迎開發人員提供建議) 1. HTTP傳輸安全以iOS9 SDK編譯的工程會預設以SSL安全性通訊協定進行網路傳輸,即HTTPS,如果依然使用HTTP協議請求網路會報系統異常並插斷要求。目前可用如下兩種方式保持用HTTP進行網路連接: A、在info.plist中加入安全網域名稱白名單(右鍵info.plist用source code開啟) <key>NSAppTransportSecurity</key><dict> <key>NSExceptionDomains</key> <dict> <key>log.umsns.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSTemporaryExceptionMinimumTLSVersion</key> <string>TLSv1.1</string> </dict> <key>sns.whalecloud.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSTemporaryExceptionMinimumTLSVersion</key> <string>TLSv1.1</string> </dict> <!-- 整合新浪微博對應的HTTP白名單--> <key>sina.cn</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>weibo.cn</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <key>weibo.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <!-- 新浪微博--> <!-- 整合授權對應的HTTP白名單--> <key>api.weixin.qq.com</key> <dict> <key>NSIncludesSubdomains</key> <true/> <key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key> <true/> <key>NSThirdPartyExceptionRequiresForwardSecrecy</key> <false/> </dict> <!-- 授權--> </dict></dict> 註:以上平台如果沒有整合直接刪除相應配置即可 B、在info.plist的NSAppTransportSecurity下新增NSAllowsArbitraryLoads並設定為YES,指定所有HTTP串連都可正常請求 <key>NSAppTransportSecurity</key><dict> <key>NSAllowsArbitraryLoads</key> </true></dict> 2. 應用跳轉(SSO等)如果你的應用使用了如SSO授權登入或跳轉分享功能,在iOS9下就需要增加一個可跳轉的白名單,指定對應跳轉App的URL Scheme,否則將在第三方平台判斷是否跳轉時用到的canOpenURL時返回NO,進而只進行webview授權或授權/分享失敗。同樣在info.plist增加: <key>LSApplicationQueriesSchemes</key><array> <!-- URL Scheme 白名單--> <string>wechat</string> <string>weixin</string> <!-- 新浪微博 URL Scheme 白名單--> <string>sinaweibohd</string> <string>sinaweibo</string> <string>sinaweibosso</string> <string>weibosdk</string> <string>weibosdk2.5</string> <!-- QQ和Qzone URL Scheme 白名單--> <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>mqqopensdkapiV3</string> <string>mqqopensdkapiV3</string> <string>wtloginmqq</string> <string>wtloginmqq2</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></array> 註:以上平台如果沒有整合直接刪除相應配置即可 3. 應用瘦身(App thining)iOS9 SDK新增了對App瘦身的功能,詳情見App thining。目前各個第三方平台進行中App thining的支援,所以為了正常使用第三方SDK及分享SDK,需要在Build Setting中將**Enable bitcode**關閉,或設定編譯標識ENABLE_BITCODE=NO。註:bitcode僅在Xcode7以上顯示並預設開啟。
iOS9適配關於URL Schemes