IOS真机调试过程中无法访问网络问题

真机安装到IP6中可以运行。但是运行过程中发现如下列的错误。

http://183.63.XX.XX:8087/apik/login.php

2018-01-29 16:07:19.359 WorkItem[555:185658] 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.

The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.

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." UserInfo={NSUnderlyingError=0x145807e60 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://183.63.XX.XX:8087/apik/login.php, NSErrorFailingURLKey=http://183.63.XX.XX:8087/apik/login.php, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}

2018-01-29 16:07:40.977 WorkItem[555:185281] _BSMachError: (os/kern) invalid capability (20)

2018-01-29 16:07:40.979 WorkItem[555:186577] _BSMachError: (os/kern) invalid name (15)

解决方案:

在info.plist文件中增加一项

App Transport Security Settings 

然后为该项增加一个子项

Allow Arbitrary Loads  为YES


最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容