NSURLConnection 以错误结束 - 代码 -1022 [英] NSURLConnection finished with error - code -1022
本文介绍了NSURLConnection 以错误结束 - 代码 -1022的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
伙计们我尝试学习无法加载的 webview 给我这样的错误:
Guys i try to learn webview it can't load give me error like:
NSURLConnection 已完成,但出现错误 - 代码 -1022
NSURLConnection finished with error - code -1022
- (void)viewDidLoad {
[super viewDidLoad];
NSString *urlString = @"http://www.sourcefreeze.com";
NSURL *url = [NSURL URLWithString:urlString];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[_webView loadRequest:request];
}
推荐答案
我认为是关于 App Transport Security.因为你的 url 不是 https.尝试在 info.plist 文件中像这样更改
I think it is about App Transport Security.Because your url is not https.Try to change like this in the info.plist file
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
这篇关于NSURLConnection 以错误结束 - 代码 -1022的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文