Loading FaceBook in UIWebView gives NSURLErrorDomain error -999 when

705 views Asked by At

all...

When loading http://m.facebook.com in my UIWebView, sometimes it loads fine and sometimes it fails with the error NSURLErrorDomain error -999. It always fails if the Facebook page prompts you to log in and then you do so.

Some folks on stackoverflow say that this error can be ignored, and that in fact portions of the FaceBook SDK itself ignore the error in their code.

So if I add code to the didFailLoadWithError method to just return when it sees this error, what does this buy me? Would the FaceBook page continue to load?

Thanks

Steve

1

There are 1 answers

0
Tom Redman On

Yes. You can do this safely (you might want to check for a Facebook URL to be extra-safe):

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    // Facebook URL can return an ignorable NSURLErrorDomain -999
    if ([error code] != NSURLErrorCancelled) {
        //show alert, do whatever...
    }
}