UIWebView不会加载(错误101)以下URL: http://afrikaans.news24.com/Sci-tech/Nuus/Rwanda-gaan-Suid-Afrikaanse-wild-invoer-20111116
我尝试过percentescapes无济于事。请帮忙!
答案 0 :(得分:1)
试试这个:
//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搜索)引导。
答案 1 :(得分:1)
尝试类似
的内容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];