我正在尝试制作广告素材但收到无效参数错误。例外甚至没有指定哪个参数错误。
try {
$link_data = new AdCreativeLinkData();
$link_data->setData(array(
AdCreativeLinkDataFields::MESSAGE => 'try it out',
AdCreativeLinkDataFields::LINK => 'http://www.google.com',
AdCreativeLinkDataFields::IMAGE_HASH => '704e55dbf724243acfb8457a4f68a92a',
));
$object_story_spec = new AdCreativeObjectStorySpec();
$object_story_spec->setData(array(
AdCreativeObjectStorySpecFields::LINK_DATA => $link_data,
));
$creative = new AdCreative(null, 'act_576834712392068');
$creative->setData(array(
AdCreativeFields::NAME => 'Sample Creative Suite CRM',
AdCreativeFields::OBJECT_STORY_SPEC => $object_story_spec,
));
$creative->create();
}
catch (Exception $e) {
echo 'Caught exception: ', $e, "\n";
}
抓住异常:异常 ' FacebookAds \ HTTP \异常\ AuthorizationException'与消息 '参数无效'
答案 0 :(得分:0)
您似乎尚未添加必须发布广告素材的网页。我认为在AdCreativeObjectStorySpecFields::PAGE_ID => 'your published page id here'
中添加object_story_spec array
可以解决您的问题。
答案 1 :(得分:0)
不要忘记将应用的状态设置为从开发中激活。这是同样失败的原因。您可以使用
更详细地检查错误catch (Exception $e) {
var_dump($e)
}