美文网首页
iOS9中HTTP协议的变化

iOS9中HTTP协议的变化

作者: Xayoung_Coder | 来源:发表于2016-01-06 13:03 被阅读0次

    问题

    iOS9以后的http请求协议无法使用。
    错误描述:

    App Transport Security has blocked a cleartext HTTP (http://) resource load since it is insecure. Temporary exceptions can be configured via your app‘s Info.plist file.
    

    原因

    由于iOS9中,苹果将原http协议改成了https协议,使用TLS1.2 SSL加密请求数据。
    解决方案
    在info.plist文件加入key

    <key>NSAppTransportSecurity</key>
        <dict>
            <key>NSAllowsArbitraryLoads</key>
            <true/>
        </dict>
    

    效果下图:

    Paste_Image.png

    相关文章

      网友评论

          本文标题:iOS9中HTTP协议的变化

          本文链接:https://www.haomeiwen.com/subject/dzuxkttx.html