简体   繁体   English

Facebook登录错误无效范围:users_friends

[英]Facebook Login Error Invalid Scope: users_friends

I have created an App using the Facebook Login and when I run the App I get this below error. 我已经使用Facebook登录名创建了一个应用,当我运行该应用时,出现以下错误。

error: canOpenURL: failed for URL: "fbauth2:/" - error: "The operation couldn't be completed. (OSStatus error -10814.)" 错误:canOpenURL:URL失败:“ fbauth2:/”-错误:“操作无法完成。(OSStatus错误-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..")
}
}

What I've got on Info.plist 我在Info.plist上得到了什么

The error I get on the App 我在应用程序上遇到的错误

It is user_friends not users_friends . 它是user_friends而不是users_friends Permissions Reference - Facebook Login 权限参考-Facebook登录

Add this line into your info.plist file. 将此行添加到您的info.plist文件中。

<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>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM