City is a field of location but I just can’t seem to retrieve it. Anyone see what I’m doing wrong?
FBSDKGraphRequest(graphPath: "me/location", parameters: ["fields": "city"]).start(completionHandler: { (connection, result, error) -> Void in
let location = result as! NSDictionary
let city = location.value(forKey: "city") as! String
print(city)
})
2
Answers
Got it. You must use location{location}.
You can not get City Name directly from Graph API so you can only get the location of user. From that location you can get the city name as well.
To get the location you need set permission and fields Like Below :