Facebook Graph API tagged_places returns empty array

谁都会走 提交于 2019-12-19 10:47:20

问题


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.


回答1:


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.




回答2:


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.




回答3:


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

me?fields=id,name,photos.limit(10){place}


来源:https://stackoverflow.com/questions/27130806/facebook-graph-api-tagged-places-returns-empty-array

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