FBSDK Login Error Code: 308 in Objective-C

前端 未结 18 3362
孤街浪徒
孤街浪徒 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:29

    One solution, at least for me, is to not run on device via the Xcode debugger. If I run the app on device outside the debugger the Facebook login works fine. If I run the app in the sim via the debugger the Facebook login works fine.

    Only if I run the app on device via the Xcode debugger do I get the com.facebook.sdk.login error 308 every time.

    0 讨论(0)
  • 2021-01-30 20:32

    I was able to get login working again on iOS9 with SDK 4.6.0 by adding the new plist key/value

    <key>FacebookDisplayName</key>
    <string>{Your App Name}</string>
    

    Source code.

    I also took the steps in some other answers here to implement a shared FBSDKLoginManager() instance.

    0 讨论(0)
  • 2021-01-30 20:33

    Updating to the latest (4.11) FB SDK fixed this for me as well. Don't forget to clean your project after updating to see if it works for you!

    0 讨论(0)
  • If you are using FBSDK 4.38 there is a bug with the parsing of challengeExpected in FBSDKLoginManager.m.

    I found a hot fix of rinat-enikeev for it:

    https://github.com/facebook/facebook-sdk-swift/issues/286

    https://github.com/facebook/facebook-objc-sdk/pull/922/commits/bcf7f787e92320a6322fb3f6130fdc3815bbafb7

    Just change

    NSString *challengeExpected = [self loadExpectedChallenge];
    

    to

    NSString *challengeExpected = [[self loadExpectedChallenge] stringByReplacingOccurrencesOfString:@"+" withString:@" "];
    

    Thats solved the issue for me.

    0 讨论(0)
  • 2021-01-30 20:40

    The solution below works for iOS9 + running on Xcode 8, for Swift3.0

    The steps are

    1. Setup Facebook Launch

    FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

    1. Setup Open Url

      guard let source = options[UIApplicationOpenURLOptionsSourceApplicationKey] as? String else { return false } let annotation = options[UIApplicationOpenURLOptionsAnnotationKey] as? String return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: source, annotation: annotation)

    2. Fix Keychain permission issue as shown in the image below

    0 讨论(0)
  • 2021-01-30 20:41

    You should enable Keychain Sharing on the Capabilities tab.

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