Xcode7(iOS9 beta1)网络请求失败,配置info.plist文件解决--iOS开发

来源:互联网 发布:数据库市场占有率 2016 编辑:程序博客网 时间:2024/05/17 06:25

Application 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.


上面的错误提示已经说明了了让你去配置info.plist文件,那就去配置呗,咋整


归根结底还是是苹果吧人家http协议改成了https协议,在iOS9 beta1的时候就改了,使用 TLS1.2 SSL加密请求数据。不知道人家怎么想的,可能认为不安全吧,所以这样做了,英文再怎么不好也能从上面的英文句子可以看到一点的。


就这样:添加一个字典,字典里添加一个BOOl值元素,详情如下:


NSAppTransportSecurity         后面的类型选择(一般默认的就是字典)->Dictionary     

子元素NSAllowsArbitraryLoadsBoolean值默认为NO,自己改成YES就好了


好了!

重新运行Application就可以了。


另外,这事苹果官网的说法,谁要有空可以顺便翻一下

App Transport Security

App Transport Security (ATS) enforces best practices in the secure connections between an app and its back end. ATS prevents accidental disclosure, provides secure default behavior, and is easy to adopt; it is also on by default in iOS 9 and OS X v10.11. You should adopt ATS as soon as possible, regardless of whether you’re creating a new app or updating an existing one.

If you’re developing a new app, you should use HTTPS exclusively. If you have an existing app, you should use HTTPS as much as you can right now, and create a plan for migrating the rest of your app as soon as possible. In addition, your communication through higher-level APIs needs to be encrypted using TLS version 1.2 with forward secrecy. If you try to make a connection that doesn't follow this requirement, an error is thrown. If your app needs to make a request to an insecure domain, you have to specify this domain in your app's Info.plist file.



0 0
原创粉丝点击