简体   繁体   中英

IOS Swift using Facebook Login instead of FBSDKLoginKit AppDelegate.swift code

Previously dealing with FBSDKLoginKit, I had to use certain code for my appDelegate.swift for the facebook login to work that are shown below:

import FBSDKLoginKit

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {

  let fbLaunch = FBSDKApplicationDelegate.sharedInstance().application(application, didFinishLaunchingWithOptions: launchOptions)

 return fbLaunch

}

func applicationWillResignActive(_ application: UIApplication) {
  FBSDKAppEvents.activateApp()
}

func application(_ application: UIApplication, open url: URL, sourceApplication: String?, annotation: Any) -> Bool {
    return FBSDKApplicationDelegate.sharedInstance().application(application, open: url, sourceApplication: sourceApplication, annotation: annotation)
}

Now that I switched to FacebookLogin, whats their code for the above?

Found the answer, had to google around with specific keywords and I think it may be slightly outdated (from 2016) but the answer is in link below:

https://github.com/facebook/facebook-sdk-swift/blob/master/Samples/Catalog/Sources/AppDelegate.swift

It runs on my xcode after compilation

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM