本文介绍了返回Facebook API朋友位置对象,其中id为空字符串,名称为null的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

昨天,当我使用查询"me/friends?fields = id,location"从Graph API中检索我的Facebook Friends时,返回了500+个位置数据.

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.

今天,位置对象返回了500多个,但是位置对象中只有36个数据,其余的返回为:

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
}

您可以在Graph API Explorer中自己复制它.您会看到一些朋友有合法的位置,但是大多数朋友都具有空值.有人知道发生了什么吗?这恰好是在宣布Graph Search的同一天发生的.有关系吗我该如何解决?

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?

更新:Facebook已将我发布的错误的状态更新为修复就绪",因此应尽快解决... https://developers.facebook.com/bugs/487611667944115

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

推荐答案

正如Zachary所说,这可能是一个Facebook错误.但是,他们将该错误标记为中"优先级,并且可能永远需要修复.如果您需要重新启动并快速运行,请改用FQL呼叫.以下内容可正确返回您所有朋友的位置数据:

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())

但是,如果您还在寻找家乡信息,那么运气不好.在这种情况下,似乎提到的错误也会影响FQL ...

If you're also looking for hometown info, though, then tough luck. Seems like the bug mentioned also affects FQL in this case...

这篇关于返回Facebook API朋友位置对象,其中id为空字符串,名称为null的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 00:02