IOS Facebook SDK: login doesn't return email despite permissions granted

后端 未结 8 2085
[愿得一人]
[愿得一人] 2020-12-10 12:46

I\'m trying to get information through the facebook sdk but so far I\'m getting only the id and the name of the user, although I\'m sure there is an email available, as it i

8条回答
  •  长情又很酷
    2020-12-10 13:39

    I struggled with this problem for almost a day until finding the answer by @HeTzi, which worked perfectly. The swift version of such a request is:

    func referenceFBData() {
        var request = FBSDKGraphRequest(graphPath:"me", parameters: ["fields":"email,first_name,gender"]);
    
        request.startWithCompletionHandler { (connection : FBSDKGraphRequestConnection!, result : AnyObject!, error : NSError!) -> Void in
            if error == nil {
                println("The information requested is : \(result)")
            } else {
                println("Error getting information \(error)");
            }
        }
    }
    

    Remember that you must first request the proper read permissions to obtain data using this request.

提交回复
热议问题