Reputation: 177
I have a running application in appstore which contains UIWebView. It worked perfectly fine till iOS 6.0. In OS 6 some hyperlinks are not working but the same thing is working fine when I use the safari browser in iOS on the iPad.
Do I need to add some extra delegate methods to make it working? Currently I m Using following code:
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:kAuthenticationURL]];
[request setValue:[NSMutableURLRequest userAgentRequests] forHTTPHeaderField:@"User-Agent"];
[request setHTTPMethod:@"POST"];
[request setHTTPShouldHandleCookies:YES];
[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
NSData *postData = [[NSString stringWithFormat:@"username=%@&code=%@", username, password]
dataUsingEncoding:NSASCIIStringEncoding];
[request setHTTPBody:postData];
delegate i have used:
1)
- (void)webViewDidStartLoad:(UIWebView *)webView
2)
- (void)webViewDidFinishLoad:(UIWebView *)webView
inside this method I have used the following for loading data:
[self.webView stringByEvaluatingJavaScriptFromString:@"window.location.reload = function(){};"];
3)
- (BOOL)webView:(UIWebView *)webViewshouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType`
Do i need to implement some thing extra for make it working in iOS 6?
Any help is appriciated...
Upvotes: 0
Views: 3032
Reputation: 65409
Maybe you're having the same problem as described here: stringByEvaluatingJavaScriptFromString is not working in iOS 6 or here iOS 6 - UIWebView loadHTMLString not working properly
It seems iOS 6 loads and renders the page differently and could be stricter then 5
You could try to suppres iOS6's incremental rendering as stated here
suppressesIncrementalRendering
A Boolean value indicating whether the web view suppresses content rendering until it is fully loaded into memory. @property(nonatomic) BOOL suppressesIncrementalRendering
You could also try to debug using your mac as described here:
Additional tip: to debug javascript errors on iOS6, a new feature makes it very simple:
- Go to the "Settings" application in your iPhone, enter the "Safari" settings and tap on "Advanced" at the bottom, then enable the "WebKit Inspector" from there
- Display your page to be debugged on the screen (i.e. launch your app and go to your screen that contains the WebView to make it visible)
- Plug your iPhone to your Mac via your USB cable
- Open Safari.app on your Mac, go to the "Development" menu (1), select the menu item with the name of your iPhone and select your application in the submenu.
You will then be able to debug your web page presented in your iPhone using the powerful Web Inspector from your Mac, and can look into the javascript console, the DOM tree, etc.
(1) If you don't have the "Development" menu in Safari on your Mac, you can enable it in the "Advanced" preferences tab of the Safari application.
More on remote debugging can be found here (scroll all the way down to 'Remote Debugging') or here (WWDC video session: "Debugging UIWebViews and Websites on iOS")
Upvotes: 1