-
-
Save codegefluester/f797dd723e93e545b855525a4b9ab057 to your computer and use it in GitHub Desktop.
import UIKit | |
import CoreData | |
@UIApplicationMain | |
class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | |
public func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey : Any]? = nil) -> Bool { | |
// Override point for customization after application launch. | |
return FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions) | |
} | |
public func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool { | |
return FBSDKApplicationDelegate.sharedInstance().application( | |
app, | |
open: url as URL!, | |
sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String, | |
annotation: options[UIApplicationOpenURLOptionsKey.annotation] | |
) | |
} | |
public func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool { | |
return FBSDKApplicationDelegate.sharedInstance().application( | |
application, | |
open: url as URL!, | |
sourceApplication: sourceApplication, | |
annotation: annotation) | |
} | |
} | |
Thanks for you solution!!!!
Good job!
Also guys having this issues look at:
Error OSStatus -10814 occures when canOpenURL: can't find any application, that can open this URL (actually, Facebook trying to find their application by calling canOpenURL: with argument "fbauth2:/"). Printing happens inside of function, so you can't do anything with that. But if you will run your application on device with installed Facebook app, you will not see this error.
Error 308 occures because of the situation, when value, stored in keychain is not equal to value, that is stored in facebook completion parameters (for more information you can check -[FBSDKLoginManager completeAuthentication:expectChallenge:]).
It happens because Apple changed the way of working with keychain in iOS 10. To fix this issue you simply should go to Targets->Capabilities and enable keychain sharing (it enables access to keychain for your app):
Full answer here http://stackoverflow.com/questions/38689631/how-to-use-facebook-ios-sdk-on-ios-10
by Roman Ermolov
I converted the Objective-C here https://developers.facebook.com/docs/ios/getting-started/ but @thisfiore saved me on the Error 308! Thanks buddy.
GREAT! Thank you
Long live bra
Thanks buddy . you are life saver
I am using this with version 4.17 of the FB SDK and getting nil for the token. Any idea on why that might be. If i use this with an older version of the FB SDK (4.15.1), it works perfectly.
use this gist: for Swift3 June 2017
https://gist.github.com/jgchoi/097b59d85d6b378a81925be93a62fef9
Good job
YOU SAVED MY LIFE!!!!!!!!!