Buon pomeriggio! Devo ottenere i dati dell'utente da Facebook. Ricevo correttamente dati come nome utente, ID, foto. Ma quando si tenta di interrogare come stato civile, ottengo una risposta a un dizionario vuoto. Ho provato a fare richieste diverse, ma ottengo sempre un risultato simile. Leggo anche questi temi official Facebook site, this, this come posso risolvere questo?come ottenere i dati utente da Facebook SDK su iOS
Il mio codice di esempio
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
})
}
}
vedo il risultato nella console
facebook {
data = (
);
}
Avete chiesto le autorizzazioni appropriate? user_relationships https://developers.facebook.com/docs/facebook-login/permissions#reference-user_relationships – TommyBs