Why am I getting com.facebook.sdk.login error 308?

后端 未结 6 2130
[愿得一人]
[愿得一人] 2021-01-31 09:22

I am using Xcode 7.0, testing on iOS 9.0.2 and using Facebook SDK 4.7.0.

When I am logging in a user, most of the time everything works as it should, however sometimes I

相关标签:
6条回答
  • 2021-01-31 10:06

    I found the solution to this problem. I was creating an instance of the login manager where i needed it:

    let loginManager = FBSDKLoginManager()
    

    Then i was using it to login and I was creating another instance in my logout method. I fixed the issue by creating a lazy variable to be used throughout the app:

    lazy var fbLoginManager: FBSDKLoginManager = {
       return FBSDKLoginManager()
    }()
    

    UPDATE

    Facebook are aware of the bug and are looking into it. I have found that my solution doesn't always work and have updated my code to the following and have not seen it since:

    private var _fbLoginManager: FBSDKLoginManager?
    
    var fbLoginManager: FBSDKLoginManager {
        get {
            if _fbLoginManager == nil {
                _fbLoginManager = FBSDKLoginManager()
            }
            return _fbLoginManager!
        }
    }
    

    When logging out of Facebook, you need to call _fbLoginManager = nil and the instance will be recreated when it is used to log in the next time. The issue seems to happen more often when using the same instance to log back in after logging out yet the issue happens even more when there are multiple instances of FBSDKLoginManager so declaring it as stated above seems to have fixed the issue.

    0 讨论(0)
  • 2021-01-31 10:07

    For Xcode8 - iOS10,

    Enable Keychain Sharing within Capabilities tab of target fixed my issue.

    More details can be found here : https://github.com/facebook/facebook-sdk-swift/issues/51


    For Xamarin Studio (Suggested by @Kenneth),

    Add the Entitlements.plist file to Custom Entitlements under the iOS Bundle Signing options in the iOS project.

    0 讨论(0)
  • 2021-01-31 10:08

    Fix available in facebook-objc-sdk https://github.com/facebook/facebook-objc-sdk/releases/tag/sdk-version-4.38.1 and above.

    0 讨论(0)
  • 2021-01-31 10:15

    October 2018.

    Reason: "+" sign is replaced by " " in challengeReceived string. Issue in FBSDK.

    Quick and dirty fix: https://github.com/facebook/facebook-objc-sdk/pull/922

    Specifically, replace line 233 in FBSDKLoginManager:

    NSString *challengeExpected = [self loadExpectedChallenge];
    

    with

    NSString *challengeExpected = [[self loadExpectedChallenge] stringByReplacingOccurrencesOfString:@"+" withString:@" "];
    
    0 讨论(0)
  • 2021-01-31 10:18

    I also had this error the reason was in my case: AuthentificationController on which was Facebook login button was presented without navigation controller. To resolve this error i just added navigation controller and sat my AuthentificationController as root.

    0 讨论(0)
  • 2021-01-31 10:22

    Looks like problem is solved with 4.9.0. I had the same problem and it's fixed with new SDK version.
    https://developers.facebook.com/docs/ios/change-log-4.x

    0 讨论(0)
提交回复
热议问题