问题
Yesterday, when I retrieved my Facebook Friends from the Graph API using the query "me/friends?fields=id,location" 500+ came back with location data.
Today, 500+ are returned with the location object, but only 36 have any data in the location object, the rest are returned as:
"location": {
"id": "",
"name": null
}
You can reproduce it yourself in the Graph API Explorer. You'll see that some friends have legitimate locations, but the majority have the null values. Does anyone have any idea what's going on? This happened to happen the same day Graph Search was announced. Is it related? How do I fix this?
UPDATE: Facebook has updated the status of the bug that I posted to "Fix Ready" so this should be resolved shortly... https://developers.facebook.com/bugs/487611667944115
回答1:
As Zachary mentions, it is probably a facebook bug. However they marked the bug as 'medium' priority and could take forever to fix. If you need to get yourself up and running quickly again, switch to an FQL call instead. The following correctly returns location data for all your friends:
SELECT name, uid, current_location FROM user WHERE uid in (SELECT uid2 FROM friend WHERE uid1 = me())
If you're also looking for hometown info, though, then tough luck. Seems like the bug mentioned also affects FQL in this case...
来源:https://stackoverflow.com/questions/14350661/facebook-api-friend-location-object-being-returned-with-empty-string-for-id-and