我正在尝试在Spring Social Facebook中获取用户位置:
Facebook fb = ((Facebook) connection.getApi());
Page pg = fb.pageOperations().getPage(fb.userOperations().getUserProfile().getLocation().getId());
问题在于
pg.getLocation()
返回null
。 我也尝试过:fb.fetchObject(fb.userOperations().getUserProfile().getLocation().getId(), org.springframework.social.facebook.api.Location.class)
但是它只填充了名称,而没有国家或其他字段。
在Graph API Explorer上尝试/v2.6/112286918797929?fields=id,name,location,结果如预期:
{
"id": "112286918797929",
"name": "Sacele",
"location": {
"city": "Sacele",
"country": "Romania",
"latitude": 45.6167,
"longitude": 25.6833
}
}
这是Spring Social Facebook出现的问题吗?
我正在使用Spring Social 1.1.4和Spring Social Facebook 2.0.3。
我也试过Spring Social for Facebook - get user location,但不幸的是,并非所有地方都按照名称约定城市,国家,某些地方只包括城市名称,不包括国家。另外,如何获取地理坐标?
user_location
权限。你指的是哪个URL? - Adrian Ber