I keep getting
\"Error Domain=com.facebook.sdk.login Code=308 \"The operation couldn’t be completed. (com.facebook.sdk.login error 308.)\"\"
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.
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.
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!
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.
The solution below works for iOS9 + running on Xcode 8, for Swift3.0
The steps are
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
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)
You should enable Keychain Sharing on the Capabilities tab.