swathy krishnan
swathy krishnan

Reputation: 916

iOS webview connection error handling

I'm trying to load a url . But sometimes it gives a error url in the following delegate method.

- (BOOL)webView:(UIWebView *)theWebView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{

    NSURL* url = [request mainDocumentURL];
    NSString* absoluteString = [url absoluteString];
    NSLog(@"%@",absoluteString);}

I want to know that how can i cancel the current url request and reload a new url ?

Upvotes: 0

Views: 665

Answers (1)

Vaisakh
Vaisakh

Reputation: 2927

try this

if([webView isLoading])
    {
        [webView stopLoading];
    }

Upvotes: 1

Related Questions