FB Graph / FQL: Current_location of friends is som

2019-04-29 17:48发布

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.

5条回答
别忘想泡老子
2楼-- · 2019-04-29 18:05

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.

查看更多
何必那么认真
3楼-- · 2019-04-29 18:06

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

查看更多
放荡不羁爱自由
4楼-- · 2019-04-29 18:09

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楼-- · 2019-04-29 18:16

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

查看更多
老娘就宠你
6楼-- · 2019-04-29 18:18

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.

查看更多
登录 后发表回答