当我使用图形api创建一个事件时,我需要指定场地,我也想显示地图。
我做
$fb_event['name'] = "THis is to test latitude"; $fb_event['description'] = "And longitude!!!!"; $fb_event['start_time'] = date( "c", Ai1ec_Facebook_Event::get_facebook_start_time($event->start)); $fb_event['location'] = "Where you want"; $fb_event['street'] = "Via andrea del sarto 9"; $fb_event['city'] = "Milan"; $fb_event['latitude'] = 45.444975793404; $fb_event['longitude'] = 9.2119209654715; $facebook = $this->facebook_instance_factory(); try { $result = $facebook->api( "/me/events", "POST", $fb_event ); } catch (FacebookApiException $e) { fb($e); }这会产生这个事件 ,显示正确的街道和城市,但没有地图。 如果我编辑事件并保存,则会正确地使用街道和城市显示地图“Magically”。
在任何情况下,都会忽略纬度和经度。
我究竟做错了什么?
When i create an event with the graph api i need to specify the venue and i would like also to show the map.
I do
$fb_event['name'] = "THis is to test latitude"; $fb_event['description'] = "And longitude!!!!"; $fb_event['start_time'] = date( "c", Ai1ec_Facebook_Event::get_facebook_start_time($event->start)); $fb_event['location'] = "Where you want"; $fb_event['street'] = "Via andrea del sarto 9"; $fb_event['city'] = "Milan"; $fb_event['latitude'] = 45.444975793404; $fb_event['longitude'] = 9.2119209654715; $facebook = $this->facebook_instance_factory(); try { $result = $facebook->api( "/me/events", "POST", $fb_event ); } catch (FacebookApiException $e) { fb($e); }This produce this event which show the correct street and city, but no map. If i edit the event and save, the map "Magically" appears using the street and city correctly.
In any case latitude and longitude are ignored.
What am i doing wrong?
最满意答案
如果您在Graph API资源管理器中比较两个测试事件,您会看到事件ID 239298922846828没有填充其纬度和经度,而245655182207213则没有。 我假设245655182207213是你编辑过的一个事件。
查看代码,您似乎正在执行文档中描述的所有操作。 但是,我发现所描述的内容并不总是有效。
我所看到的是,Facebook内部发生的事件发生在已知场所,不再允许您指定地址。 相反,他们所保存的只是Facebook中的一个场地ID,然后你可以钻进去获取地址等。
看看我的一个活动 。 对于此活动,无法在Facebook内编辑此位置的详细信息,也无法通过API调用返回事件地点详细信息。 我正在使用API将事件详细信息提取到外部网站。 这种变化让我感到沮丧。
我在4月下旬开始看到这种行为。 我没有找到任何宣布这一变化的官方文件。
当出现一些文档时,我期望新的活动场地工作流程是这样的:
查询您的活动所在的区域,以查看是否已有场地。 如果是,请保存其ID。 如果没有,请为您的场地创建一个新社区页面并保存其ID。 使用此ID填充活动地点。In the end this is a known facebook bug
https://developers.facebook.com/bugs/173095916131752
更多推荐
发布评论