Bor*_*eto 7 url https uiwebview asihttprequest ios
我开始iPhone编程,我有一个很大的问题,我无法解决.
所以,我有一个UIWebview,我可以加载HTTP网址没有问题:
NSString urlAdress;
urlAdress = @"http://servername";
NSURL *url = [NSURL URLWithString:urlAdress];
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
[webView loadRequest:requestObj];
Run Code Online (Sandbox Code Playgroud)
它的工作,我的页面加载在我的UIwebView中,但当我替换:
urlAdress = @"http://servername";
Run Code Online (Sandbox Code Playgroud)
通过
urlAdress = @"https://servername";
Run Code Online (Sandbox Code Playgroud)
我有空白屏幕.
我读了它的正常,但有没有简单的方法来加载我的webview中的https网址?
我读过ASIHTTPRequest但我没有到达实施它.
我只想加载HTTPS URL.
试试这个 :
- (BOOL)connection:(NSURLConnection *)connection canAuthenticateAgainstProtectionSpace:(NSURLProtectionSpace *)protectionSpace {
return YES;
}
- (void)connection:(NSURLConnection *)connection didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)challenge {
[challenge.sender useCredential:[NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust] forAuthenticationChallenge:challenge];
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
13998 次 |
| 最近记录: |