下午好!我需要从 Facebook 获取用户数据。我成功获取了用户名、id、照片等数据。但是当您尝试查询婚姻状况等时,我会得到一个空字典的响应。我试图提出不同的要求,但总是得到这样的结果。我还阅读了这些主题官方 Facebook 网站,这个,这个,我该如何解决这个问题?
我的示例代码
static func getUserRelationship() {
if (FBSDKAccessToken.currentAccessToken() != nil) {
guard let currentUser = getCurrentFacebookUser() else { return }
FBSDKGraphRequest(graphPath: "/\(currentUser.id)/family", parameters: nil, HTTPMethod: "GET").startWithCompletionHandler({ (requestConnection, result, error) in
if error == nil {
let dictionary = result as! [String : AnyObject]
let array = dictionary["data"]
print("facebook", result, dictionary, array?.count)
} else {
print(error.localizedDescription)
}
})
} else {
getDataLogin({
getUserBirthday()
}, fails: { (error) in
})
}
}
我在控制台中看到了结果
facebook {
data = (
);
}