I keep getting
"Error Domain=com.facebook.sdk.login Code=308 "The operation couldn’t be completed. (com.facebook.sdk.login error 308.)""
upon trying to login with Facebook from my device.
My code works on the simulator, but not on an actual device. Has anyone ran into this error code before? I'll be more than happy to share code upon request.
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
to
Thats solved the issue for me.
I had the same problem and fixed it refreshing the system credentials
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.
In the FBSDKDelegate Method loginButtonWillLogin put this
My solution on Xcode7.1, Swift2.0
Step 1. Clean your build folder:
option
+command
+K
or: Choose
Product
>Clean
Step 2. Clean your derived data: Choose
Window
>Projects
:and then choose
Delete
:I followed Suraj Pathak with Xcode 9.4.1 and Swift 4.2
Add to AppDelegate didFinishLaunchingWithOptions
Add to AppDelegate delegate function
Allow Keychain in Capabilities.
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.