iOS SWift Facebook Login
Prerequisite
- brew
- Cocoapod
- FacebookSDK
Facebook app
-
pod init
textpod 'FacebookCore'
pod 'FacebookLogin'
pod 'FacebookShare'
from: https://developers.facebook.com/docs/swift/getting-started
- AppDelegate.swift
textfunc application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)
return true
}
func application(_ app: UIApplication, open url: URL, options: [UIApplicationOpenURLOptionsKey : Any] = [:]) -> Bool {
let handled = FBSDKApplicationDelegate.sharedInstance().application(app, open: url, sourceApplication: options[UIApplicationOpenURLOptionsKey.sourceApplication] as! String!, annotation: options[UIApplicationOpenURLOptionsKey.annotation])
return handled
}