【发布时间】:2011-11-17 09:54:59
【问题描述】:
UIWebView 不会加载(错误 101)以下 URL: http://afrikaans.news24.com/Sci-tech/Nuus/Rwanda-gaan-Suid-Afrikaanse-wild-invoer-20111116
我试过percentescapes 无济于事。请帮忙!
【问题讨论】:
标签: ios cocoa-touch uiwebview
UIWebView 不会加载(错误 101)以下 URL: http://afrikaans.news24.com/Sci-tech/Nuus/Rwanda-gaan-Suid-Afrikaanse-wild-invoer-20111116
我试过percentescapes 无济于事。请帮忙!
【问题讨论】:
标签: ios cocoa-touch uiwebview
试试这个:
//Set the URL to go to for your UIWebView
NSString *webAddressString = @"http://afrikaans.news24.com/Sci-tech/Nuus/Rwanda-gaan-Suid-Afrikaanse-wild-invoer-20111116";
NSLog(@"show webAddressString: %@", webAddressString);
//Create a URL object.
NSURL *weburl = [NSURL URLWithString:webAddressString];
[webAddressString release];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:weburl];
//load the URL into the web view.
[aWebView loadRequest:requestObj];
错误 101 是 The operation couldn’t be completed.,由未找到域、网络问题甚至对象分配(从 Google 搜索)导致。
【讨论】:
试试类似的东西
NSString *unencodedURLString = @"http://afrikaans.news24.com/Sci-tech/Nuus/Rwanda-gaan-Suid-Afrikaanse-wild-invoer-20111116";
NSString *encodedURLString = [unencodedURLString stringByAddingPercentEscapesUsingEncoding: NSUTF8StringEncoding];
//Create a URL object.
NSURL *weburl = [NSURL encodedURLString];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:weburl];
//load the URL into the web view.
[aWebView loadRequest:requestObj];
【讨论】: