У меня есть простое родное приложение iOS, которое загружает один UIWebView. Я хотел бы, чтобы webView отображал сообщение об ошибке, если приложение НЕ ПОЛНОСТЬЮ завершает загрузку начальной страницы в webView в течение 20 секунд.
Я загружаю свой URL-адрес для webView в свой viewDidLoad
как это (упрощенный):
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://www.example.com"] cachePolicy:NSURLCacheStorageAllowed timeoutInterval:20.0]];
timeoutInterval
в приведенном выше коде фактически ничего не делает, так как Apple установила его в OS, чтобы на самом деле не было времени на 240 секунд.
У меня установлены мои действия webView didFailLoadWithError
, но если у пользователя есть сетевое соединение, это никогда не будет вызвано. WebView просто продолжает загружаться с помощью функции networkActivityIndicator.
Есть ли способ установить тайм-аут для webView?