FBSDK Login Error Code: 308 in Objective-C

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

    Did some digging around in FBs code and it looks like this is simply an entitlements issue.

    FB uses the keychain to store an authorization challenge during login. When returning it attempts to get the value from the keychain and fails. See this SO answer for more info.

    Security entitlements can change between provisioning profiles, and as we all know, keeping our profiles and build configurations and devices/sims straight is like herding cats. This could explain why people experience such inconsistent behavior.

    So it might be safe to assume that in a production environment, everything will work fine, and if things aren't working during testing then you need to double-check the entitlements on your provisioning profiles.

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

    I fixed the problem by uninstalling the app and re-installing and it worked right away.

    The error is probably related to iOS 9. Since iOS 9, I think the SDK uses SafariViewController and it seems to create issues when you are already logged.

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

    To Resolve this issue you needs to just enable "Keychain Sharing" in capabilities.

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

    I had exactly the same problem and was able to find the solution by modifying the Info.plist

    I've added all the possible schemes to LSApplicationQueriesSchemes

    The complete list looks like this:

    <key>LSApplicationQueriesSchemes</key>
    <array>
        <string>fbapi</string>
        <string>fbapi20130214</string>
        <string>fbapi20130410</string>
        <string>fbapi20130702</string>
        <string>fbapi20131010</string>
        <string>fbapi20131219</string>
        <string>fbapi20140410</string>
        <string>fbapi20140116</string>
        <string>fbapi20150313</string>
        <string>fbapi20150629</string>
        <string>fbauth</string>
        <string>fbauth2</string>
        <string>fb</string>
        <string>fb-messenger-api20140430</string>
        <string>fb-messenger-platform-20150128</string>
        <string>fb-messenger-platform-20150218</string>
        <string>fb-messenger-platform-20150305</string>
        <string>fb-messenger-api</string>
        <string>fbshareextension</string>
    </array>
    
    0 讨论(0)
  • 2021-01-30 20:47

    In my case it was fixed by updating to latest FB SDK. 4.10 at the moment.

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

    I followed Suraj Pathak with Xcode 9.4.1 and Swift 4.2

    1. Add to AppDelegate didFinishLaunchingWithOptions

      SDKApplicationDelegate.shared.application(application, didFinishLaunchingWithOptions: launchOptions)
      
    2. Add to AppDelegate delegate function

      func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
          return SDKApplicationDelegate.shared.application(app, open: url, options: options)
      }
      
    3. Allow Keychain in Capabilities.

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