I have created an App using the Facebook Login and when I run the App I get this below error.
error: canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn't be completed. (OSStatus error -10814.)"
class ViewController: UIViewController, FBSDKLoginButtonDelegate {
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
if(FBSDKAccessToken.current()==nil){
print("Not Logged In")
}
else{
print("Logged In..")
}
let loginButton = FBSDKLoginButton()
loginButton.delegate = self
loginButton.readPermissions = ["public_profile","email","users_friends"]
loginButton.center = self.view.center
self.view.addSubview(loginButton)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func loginButton(_ loginButton: FBSDKLoginButton!, didCompleteWith result: FBSDKLoginManagerLoginResult!, error: Error!) {
if(error == nil){
print("login complete")
}
else{
print(error.localizedDescription)
}
}
func loginButtonDidLogOut(_ loginButton: FBSDKLoginButton!) {
print("Logged out..")
}
}
It is user_friends
not users_friends
. Permissions Reference - Facebook Login
Add this line into your info.plist file.
<key>LSApplicationQueriesSchemes</key>
<array>
<string>fbapi</string>
<string>fbapi20130214</string>
<string>fbapi20130410</string>
<string>fbapi20130702</string>
<string>fbapi20131010</string>
<string>fbapi20131219</string>
<string>fbapi20140410</string>
<string>fbapi20140116</string>
<string>fbapi20150313</string>
<string>fbapi20150629</string>
<string>fbauth</string>
<string>fbauth2</string>
<string>fb-messenger-api20140430</string>
</array>
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.