iosswiftfacebookfacebook-loginfbsdkloginkit

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?


Solution

  • 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