First dialog after authenticating fails immediately and closes dialog
Solution 1:
Just an update for everyone, it's finally assigned to somebody at Facebook: https://developers.facebook.com/bugs/168127053284477 - hopefully it will be fixed soon.
Meanwhile, somebody sent a pull request on github with a fix: https://github.com/facebook/facebook-ios-sdk/pull/436
Hope it helps someone, as I was still facing the same bug..
Solution 2:
I was also occasionally getting this -999 NSURLDomainError when trying to bring up the facebook post window. I took the strategy of ignoring the error code as Senior mentions in the comments.
The reason I don't feel so bad about this fix is that the FBLoginDialog actually already ignores this error. Check out the code in github:
https://github.com/facebook/facebook-ios-sdk/blob/master/src/FBLoginDialog.m#L85
So to be specific, here's what my webView:didFailLoadWithError method looks like in FBDialog.m now:
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error {
// 102 == WebKitErrorFrameLoadInterruptedByPolicyChange
NSLog(@"FBDialog webView didFailLoadWithError:%@ %d",error.domain,error.code);
if ([error.domain isEqualToString:@"NSURLErrorDomain"] && error.code == -999)
return;
if ([error.domain isEqualToString:@"WebKitErrorDomain"] && error.code == 102)
return;
[self dismissWithError:error animated:YES];
}