My app uses UIWebview, and it works well in iOS 5 and iOS 6. However, it doesn't load the webpage in iOS 7 when I build in Xcode 5 and run the same code.
- (void)webViewDidFinishLoad:(UIWebView *)webView {}
- (void)webViewDidStartLoad:(UIWebView *)webView {}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {}
All delegate function is not called. But I do set delegate in xib file and code
self.theWebView.delegate = self;
I didn't find any information via google. Thank you for your help.
I moved the loadRequest method to the completion handler of a presentViewController and it works in iOS 5, 6 and 7:
I found the root cause. maybe I incorrectly used
UIWebView
, but it works in iOS5 and iOS6. I don't know why it works in earlier iOS versions...Moreover, it works in iOS7 when I build code with SDK 6.1.
Here's my old code.
I moved the
loadRequest
from theviewDidLoad
method to theViewWillAppear
method, then it worked. I think maybeUIWebView
is not initialized correctly in my old code for iOS7.