Good afternoon! I need to get user data from Facebook. I successfully get data such as the user name, id, photo. But when you try to query such as marital status, I get a response to an empty dictionary. I tried to make different requests, but always get such a result. I also read these themes official Facebook site, this, this like How can I fix this?
My example code
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
})
}
}
I see the result in the console
facebook {
data = (
);
}