我试图在uiwebview中打开一个链接,它没有打开并抛出错误。
Error Domain=NSURLErrorDomain Code=-999 "The operation couldn’t be completed. (NSURLErrorDomain error -999.)" UserInfo=0x9a2b020 {NSErrorFailingURLKey=http://epapir.info/apotek1/1402/#/1/, NSErrorFailingURLStringKey=http://epapir.info/apotek1/1402/#/1/}
并显示图片
请指教。它在iPhone的safari浏览器中打开并在那里运行良好。以下是我的代码。
- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *url = [NSURL URLWithString:urlAddress];
//URL Requst Object
NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
//Load the request in the UIWebView.
[webView loadRequest:requestObj];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
[activity stopAnimating];
}
-(void)webViewDidFinishLoad:(UIWebView *)webView
{
[activity stopAnimating];
}
1。https://github.com/mariohahn/MHVideoPhotoGallery
2。https://github.com/hpique/Haneke
https://github.com/muhku/FreeStreamer
https://github.com/douban/DOUAudioStreamer
https://www.cocoacontrols.com/controls/nprimageview
https://github.com/spoletto/SPUserResizableView
http://www.appcoda.com/ios-programming-import-contact-address-book/
http://code.tutsplus.com/tutorials/forward-geocoding-with-clgeocoder--mobile-11011
http://paxcel.net/blog/expandablecollapsible-table-for-ios/
https://github.com/jdriscoll/ads-sample-stock-price-fetcher
https://github.com/aporat/KKProgressToolbar
http://www.appcoda.com/background-transfer-service-ios7/ https://github.com/iPhoneNoobDeveloper/Pinterest-Demo/blob/master/CHTCollectionViewWaterfallLayout.m
https://github.com/summerblue/iOS-6-Recipes-SourceCode
http://www.appcoda.com/objective-c-blocks-tutorial/
http://useyourloaf.com/blog/2010/09/13/repeating-an-ios-local-notification.html http://www.java2s.com/Open-Source/Objective_C_Free_Code/Animation/List_of_Free_code_Animation.htm
答案 0 :(得分:0)
尝试这样的事情..
if ([[UIApplication sharedApplication]canOpenURL:url])
{ [[UIApplication sharedApplication] openURL:url];
}
尽管
在VoewDidappear方法中使用它答案 1 :(得分:-1)
只需在didFailLoadWithError中添加NSLog并检查
-(void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
[activity stopAnimating];
NSLog(@"ERROR : %@",error); //Get informed of the error FIRST
}