更新到FB API后无法获取用户信息

时间:2018-05-17 20:28:24

标签: ios facebook facebook-graph-api

错误消息:

  

无效的范围:user_birthday,user_photos,user_gender。这条信息   仅向开发者展示

在他们的api中更新Facebook后,我收到user_birthday,user_photos,user_gender的无效范围消息。我还没有提交我的应用程序进行登录审核,但是,作为应用程序的管理员,我不应该有任何与权限相关的错误。我可能做错了什么?

FBSDKLoginManager().logIn(withReadPermissions: ["email", "public_profile", "user_birthday", "user_photos", "user_gender"], from: self) { (result, err) in
    print("open facebook safari")
    if (err != nil) {
       print("Fb Login Failed", err ?? "")
       self.dismiss(animated: true, completion: nil)
    }
    self.handleFirebase()
}


FBSDKGraphRequest(graphPath: "/me", parameters: ["fields": "id, name, first_name, last_name, gender, birthday, picture.width(400).height(400)"]).start(completionHandler: { (connection, result, error) in

                if let error = error {
                    print(error.localizedDescription)
                } else {

                    if let userData = result as? NSDictionary {

                        self.firstName = userData.object(forKey: "first_name") as? String

                        self.gender = userData.object(forKey: "gender") as? String

                        self.birthday = userData.object(forKey: "birthday") as? String ?? ""


                        let pictureDictionary = userData.object(forKey: "picture") as! NSDictionary
                        let pictureSubDictionary = pictureDictionary.object(forKey: "data") as! NSDictionary
                        self.userProfileUrl = pictureSubDictionary.object(forKey: "url") as! String
                    }
                }

0 个答案:

没有答案