I am using the below methods to login to fb through my app. It is successfully navigating to login page but printing an error as follows: **-canOpenURL: failed for URL: "fbauth2:/" - error: "(null)" ** using swift 2.1.1 and facebook sdk 4.13.1
let fbLoginManager = FBSDKLoginManager()
fbLoginManager.logInWithReadPermissions(["email"], fromViewController: self) { (result, error) -> Void in
if (error == nil){
let fbloginresult : FBSDKLoginManagerLoginResult = result
if fbloginresult.grantedPermissions != nil && fbloginresult.grantedPermissions.contains("email")
{
self.getFBUserData()
// fbLoginManager.logOut()
}
}
}
}
func getFBUserData(){
if((FBSDKAccessToken.currentAccessToken()) != nil){
FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, first_name, last_name, picture.type(large), email, gender"]).startWithCompletionHandler({ (connection, result, error) -> Void in
if (error == nil){
print(result)
let view = self.storyboard?.instantiateViewControllerWithIdentifier("View") as! SignupViewController
self.presentViewController(View, animated: true, completion: nil)
}
})
}
}
Using
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fb-messenger-api</string>
<string>fbauth2</string>
<string>fbshareextension</string>
</array>
Also when I am redirecting to View, it goes to loginview and then going to redirected View.can anyone help me...