FB Graph / FQL: Current_location of friends is sometimes reading Null when FB page shows a location

≡放荡痞女 提交于 2019-12-22 05:58:19

问题


I am attempting to pull the current location of all of a user's friends on facebook, and am running into a curious problem wherein some of those friends are reading out NULL when I can see on their actual Facebook pages that it says "Lives in ,." The difficult part of this error is that it only happens on probably ~30% of cases. On the remaining cases, it pulls all of the correct information, which tells me that the permissions are probably set up correctly.

To be specific, the FQL code I am using is:

SELECT uid,
       name,
       current_location
FROM   USER
WHERE  uid IN (SELECT uid2
               FROM   friend
               WHERE  uid1 = Me())

This same issue has arisen when making javascript requests directly to the graph, so it doesn't appear to be an FQL issue either. Does anyone know why current_location might sometimes fail and report NULL, but not always?

Thank you.


回答1:


Privacy settings have a higher priority than facebook api's.

If user has restricted particular info from privacy setting, you wont be able to fetch that by facebook api's (graph, fql, rest api) even if user grants permission for that.

e.g.

If I have restricted to share my birthday on privacy setting, no app would be able to grab my birthday even if they ask for it.

Also, user can restrict apps from getting particular info.

e.g. User can allow app xyz to access everything they want but at the same time user can restrict app xyz to access his location

I hope this answers your question.




回答2:


There are 2 possibilities; The friends of the user who have current_location null :

1) Did not specify their current location in their facebook profile

2) They specified the current location in their facebook profile but their privacy setting denies you to see it




回答3:


I have the same problem.

I've checked two different users which are friends of me.

In both cases FQL query like:

select uid, first_name, name, birthday, birthday_date, current_address, current_location, hometown_location, sex from user where uid in (select uid2 from friend where uid1 = me()

returns null for home_location.

I'd checked both accounts and home location was accessible for all (both privacy and app privacy settings).

My access token included all required permissions (home location was shown for other friends).

Then I run FQL console with query:

select uid, first_name, name, birthday, birthday_date, current_address, current_location, hometown_location, sex from user where uid = nnnn

as owner and the results were:

  • Owner got home location.
  • On my old FQL Console browser tab -- still no home location.
  • On my new FQL console browser tab -- I got home location.

After a while I got home location on old FQL console.

But old queries still didn't return home location...

Seems like some caching problem on FB side.




回答4:


Same issue here. I can retrieve current_location or hometown_location for NONE of my friends. For most of them I can easily see it by visiting their profile though. App permissions friends_location and friends_hometown are set.




回答5:


Try this query to get current location of your friends

SELECT first_name,uid, last_name, current_location.name 
FROM user 
WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = me()) AND current_location

Also u will need friends_location permission to run this query



来源:https://stackoverflow.com/questions/10443870/fb-graph-fql-current-location-of-friends-is-sometimes-reading-null-when-fb-pa

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!