1.在Info.plist中添加NSAppTransportSecurity类型Dictionary。
2.在NSAppTransportSecurity下添加NSAllowsArbitraryLoads类型Boolean,值设为YES
用source code打开如下:
<key>NSAppTransportSecurity</key>
<dict>
<!--Connect to anything (this is probably BAD)-->
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
针对个别网站配置
![D5PO]DYP53WT9ZRG%@$VY.jpg](http://upload-images.jianshu.io/upload_images/228486-2153743117f36c38.jpg?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240)
1.子域名同样适用
NSIncludesSubdomains Boolean类型 YES
2.禁用ForwardSecrecy
NSExceptionRequiresForwardSecrecy Boolean类型 NO
3.允许签名过期 或者不匹配情况
NSTemporaryExceptionAllowsInsecureHTTPLoads Boolean类型 YES
用source code打开如下:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSExceptionDomains</key>
<dict>
<key>baidu.com</key>
<dict>
<key>NSExceptionRequiresForwardSecrecy</key>
<false/>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSTemporaryExceptionMinimumTLSVersion</key>
<string>TLSv1.1</string>
</dict>
</dict>
</dict>
iOS 9 分享适配
URL Scheme 用于应用程序的分享或者跳转到其他平台的授权,分享或者授权后再跳回来
在iOS 8 没有做限制,但是在iOS 9 需要将在外部调用的URL Scheme列为白名单才可以跳转
没做适配的情况下 会报错:
-canOpenURL: failed for URL: "mqq://" - error: "This app is not allowed to query for scheme mqq"
解决办法:在info.plist设置LSApplicationQueriesSchemes(数组),在里面添加用到的URL Scheme
用source code打开如下:
<key>LSApplicationQueriesSchemes</key>
<array>
<!-- 微信 URL Scheme 白名单-->
<string>wechat</string>
<string>weixin</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>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>
</array>
============================================
注:
<!-- 集成微信、QQ、Qzone、腾讯微博授权对应的HTTP白名单-->
<key>qq.com</key>
<dict>
<key>NSIncludesSubdomains</key>
<true/>
<key>NSThirdPartyExceptionAllowsInsecureHTTPLoads</key>
<true/>
<key>NSThirdPartyExceptionRequiresForwardSecrecy</key>
<false/>
</dict>
<!-- 腾讯授权-->
============================================