Facebook Graph API tagged_places returns empty arr

2019-02-20 18:15发布

I'm trying to get a users tagged_places but the array always comes back empty. If I go through the Graph explorer and generate a token then I get the results as expected but using an access token generated in my application I get returned an empty array. I am requesting the user_tagged_places permission, I know that my app will have to go for review because of this permission requirement but I am just testing right now with my own developer account and test users but it doesn't work for any of them. Will I be able to get the data prior to sending my app for review? Thanks in advance for the help. EDIT: Here's the request

function get_fb_tagged_places($session, $uid)
{
    $request = new FacebookRequest($session, 'GET', '/'.$uid.'/tagged_places');
    $response = $request->execute();
    $graphObject = $response->getGraphObject();
    $events_array = $graphObject->asArray();
    return $events_array;
}

UPDATE: Just to be sure I added every permission to my app and it now works! To save me the hassle of removing permissions until I figure it out, does anybody know exactly which permissions are needed to get tagged_places? I assumed that user_tagged_places was all that was needed because that's all the SDK guide mentions but obviously there are other permissions required.

3条回答
做自己的国王
2楼-- · 2019-02-20 18:44

I have had a similar issue and it wasnt the read_stream permission I needed. So I went through permissions in groups testing them out and I figured out what the problem was. You need to have the permission of the item you were tagged in. So in my case I was tagged in photos, so I needed user_photos permission to gain access to user_tagged_places. You were obviously tagged in someones post on their stream so you needed that permission. It actually creates quite an issue because you need to know how a user was tagged to retrieve their tagged_places.

查看更多
叼着烟拽天下
3楼-- · 2019-02-20 18:51

The way i worked around this was by querying for photos first and then its place.

me?fields=id,name,photos.limit(10){place}
查看更多
等我变得足够好
4楼-- · 2019-02-20 19:06

EDIT: It was pointed out that read_stream is not what is required, it is whatever the user was tagged in.

Found the answer in the end, the permission: read_stream also seem to be required in order to see a users tagged_places however I did not see this mentioned in the docs anywhere.

查看更多
登录 后发表回答