天天看點

Error Domain=NSURLErrorDomain Code=-1022

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=0x7fdd22200b20 {Error Domain=kCFErrorDomainCFNetwork Code=-1022 "(null)"}, NSErrorFailingURLStringKey=http://192.168.10.155:80/service=token_request&validateStr=hengda1024&uniqueKey=1236, NSErrorFailingURLKey=http://192.168.10.155:80/service=token_request&validateStr=hengda1024&uniqueKey=1236, NSLocalizedDescription=The resource could not be loaded because the App Transport Security policy requires the use of a secure connection.}

iOS開發中依然使用http請求,而非https請求,必須要專門設定一下plist:

添加App Transport Security Settings, 展開後輸入Allow Arbitrary Loads,值改成YES

如下圖所示: