美文网首页
The resource could not be loaded

The resource could not be loaded

作者: 弦歌芳华 | 来源:发表于2016-03-16 23:04 被阅读76次

    Xcode 升级到7.3beta版后,做http的网络访问的时候会报错:
    error------ Error Domain=NSURLErrorDomain Code=-1022 "The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}

    网络搜索之后才知道,Xcode9引入了新特性ATS,要求app访问的网络必须使用HTTPS协议。如果想要继续访问http网页,需要在info.plist文件中添加NSAppTransportSecurity关键字,其类型为Dictionary,在它下面添加NSAllowsArbitraryLoads类型Boolean,值设为YES。这样就可以接着访问http网页啦~~

    相关文章

      网友评论

          本文标题:The resource could not be loaded

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