2011-11-17 88 views

回答

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.,由或域導致沒有發現,網絡問題,甚至(從谷歌搜索)對象分配。

+0

得到它這樣的工作,但不幸的是我不能硬編碼的URL – RunLoop

+2

發現問題,字符串包含無形的新行字符 – RunLoop

+0

+1媽呀,這是我的問題太多!我以爲我瘋了。可能很高興更新您的問題以反映修復。如果你願意,我會問這個問題。 (幾乎用+0跳過了這個問題) – eric

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];