First dialog after authenticating fails immediately and closes dialog

前端 未结 6 1951
庸人自扰
庸人自扰 2020-11-30 06:40

I\'m using the latest Facebook SDK on iOS 5. I can use SSO to successfully authenticate the user, and then I attempt to share a link like this:

NSString *app         


        
6条回答
  •  没有蜡笔的小新
    2020-11-30 07:28

    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];
    }
    

提交回复
热议问题