真机安装到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
网友评论