NSURLConnection完成错误 - 代码-1022 [英] NSURLConnection finished with error - code -1022

查看:1968
本文介绍了NSURLConnection完成错误 - 代码-1022的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计
i尝试学习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。因为您的网址不是https.Try在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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆