I am using UIWebView to display some content. As part of this content, a user can navigate through a bunch of sites that are loaded using AJAX. One step on this site is quite time consuming. Since I did not find anything about the time for the UIWebView , I tried to install it on the initial NSURLRequest , which it loads.
Unfortunately, this does nothing. I'm not quite sure if I have to set a timeout myself? Is there something I'm missing? Does UIWebView my timeout? I'm a little confused by this, so any help would be appreciated. :)
Best
-f
Update
I built a test project to test my βtheoryβ of how UIWebView works with timeouts. Here is the setup:
- a php file called sleep.php that has a parameter with which I can set the timeout until it sends the result
A small Xcode project with a single view, which is a webView that loads sleep.php as follows:
NSURLRequest * request = [Request NSURLRequestWURUR: url cachePolicy: NSURLCacheStorageAllowed timeoutInterval: 10]; [webView loadRequest: request];
So, during playback with the seconds parameter, I could see that the UIWebView working as it should. I get either webViewDidFinishLoad: or webView:didFailLoadWithError: depending on the timeout.
After checking that timeoutInterval works as advertised, I cited proxy.php (which has two sleep.php links configured for 5 and 15 seconds) to check if my request configuration is saved for new requests. I modified the original NSURLRequest to use proxy.php, but left a 10 second timeout configuration.
When the application starts, two links are now displayed. When I click the first one, it loads as expected after 5 seconds. Unfortunately, the second link also loads in 15 seconds.
So, my first attempt to reconfigure NSURLRequest would be to change it in webView:shouldStartLoadWithRequest:navigationType: Unfortunately, the web service is working with AJAX again, so the delegate method is not called.
Any other suggestions? Is there a way to globally set the timeout value for the entire UIWebView ?
Best
-f