I'm running the most recent version of XCode and Swift. I'm trying to implement Facebook Login; however, I keep on running into persistent errors.
First I am getting this:
-canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn’t be completed. (OSStatus error -10814.)"
I implemented the solutions listed here yet still no luck. How to use Facebook iOS SDK on iOS 10
I've tried double checking Keychain Access On, Reinstalling FacebookSDK, implementing it in various different ways such as: http://ashishkakkad.com/2015/05/facebook-login-swift-language-ios but I can't seem to get around this.
Here is my login result: Optional(<FBSDKLoginManagerLoginResult: 0x170251550>
Not sure if that is right. Also I get this error though I don't have network loss on and my wifi is perfectly connected. Could not successfully update network info during initialization.
@IBAction func fbLoginButtonPressed(_ sender: AnyObject) {
let fbLoginManager : FBSDKLoginManager = FBSDKLoginManager()
fbLoginManager.logIn(withReadPermissions: ["email"], from: self) { (result, error) in
print("Here is the result", result)
print("Here is the error" , error)
if (error == nil){
print("the error is nil")
let fbloginresult : FBSDKLoginManagerLoginResult = result!
//commenting if statement out temporarily for debugging purposes
// if(fbloginresult.grantedPermissions.contains("email"))
// {
print("email is contained and printing result")
self.getFBUserData()
fbLoginManager.logOut()
// }
}
}
}
func getFBUserData(){
if((FBSDKAccessToken.current()) != nil){
FBSDKGraphRequest(graphPath: "me", parameters: ["fields": "id, name, first_name, last_name, picture.type(large), email"]).start(completionHandler: { (connection, result, error) -> Void in
print("inside get FB user data")
if (error == nil){
self.dict = result as! [String : AnyObject]
print(result!)
print(self.dict)
}
})
}
}
Why is this occurring and how can this be resolved?
