When I click on login with Facebook button, it is opening safari browser and getting closed immediately. Noticed error on the console.
App delegate method:
I figured out my issue. It was just the syntax in loginButtonClicked function. The error message was leading me down the wrong path. Here is the working code.
@objc func loginButtonClicked() {
self.login = FBSDKLoginManager()
self.login.logIn(withReadPermissions: ["public_profile"], from: self, handler: {(result, error) -> Void in
if error != nil {
print("Process error")
}
else if (result?.isCancelled)! {
print("Cancelled")
}
else {
print("Logged in")
DispatchQueue.main.async(execute: {
let viewController:UIViewController = self.storyboard?.instantiateViewController(withIdentifier: "UITabBarController") as! UITabBarController
self.present(viewController, animated: true, completion: nil)
})
}
})
}