我正在尝试使用Object API创建一个新的 app 对象。这是我的代码......
$facebook->api('/app/objects/place', 'post', [
'access_token' => getFacebookAppToken(),
'object' => json_encode([
"title" => $row['title'],
"image" => "http://www.mydomain.com/images/$id.jpg",
"url" => "http://www.mydomain.com/?id=$id",
"description" => $row['ShortDescription'],
"location:altitude" => '0',
"location:latitude" => $row['GeoLatitude'],
"location:longitude" => $row['GeoLongitude']
])
]);
我收到了这个错误...
OAuthException:(#100)缺少必需值的对象:URL处的对象 'place'类型的'http://www.mydomain.com/?id=847'无效,因为 'geo_point'类型的必需属性'place:location'不是 提供。
答案 0 :(得分:0)
位置信息应嵌套在“数据”数组....
$facebook->api('/app/objects/place', 'post', [
'access_token' => getFacebookAppToken(),
'object' => json_encode([
"title" => $row['title'],
"image" => "http://www.mydomain.com/images/$id.jpg",
"url" => "http://www.mydomain.com/?id=$id",
"description" => $row['ShortDescription'],
"data" => [
"altitude" => '0',
"latitude" => $row['GeoLatitude'],
"longitude" => $row['GeoLongitude']
]
])
]);