FBSDK Login Error Code: 308 in Objective-C

前端 未结 18 3379
孤街浪徒
孤街浪徒 2021-01-30 20:13

I keep getting

\"Error Domain=com.facebook.sdk.login Code=308 \"The operation couldn’t be completed. (com.facebook.sdk.login error 308.)\"\"

18条回答
  •  情话喂你
    2021-01-30 20:51

    I had the same problem and fixed it refreshing the system credentials

    [FBSDKLoginManager renewSystemCredentials:^(ACAccountCredentialRenewResult result, NSError *error) {
    
        [[[YourAuthManager manager] facebookLoginManager] logInWithReadPermissions:@[@"email"] fromViewController:nil handler:^(FBSDKLoginManagerLoginResult *result, NSError *error) {
    
            if (error) {
                // Handle error
            } else if (result.isCancelled) {
                // Handle cancellations
            } else {
                // If you ask for multiple permissions at once, you
                // should check if specific permissions missing
                if ([result.grantedPermissions containsObject:@"email"]) {
                    // Do work
                }
            }
        }];
    }];
    

    This solution is less radical than reinstalling and you assure your users won't have to do it. My guess is that FBSDK 4.6 has some conflicts with iOS 9 system FB authentication credentials.

    Edited: After some time testing it kept happening, not as often as before but it was still an issue, so we downgraded to a previous version of FB SDK. Hopefully someone finds a better solution.

提交回复
热议问题