2017-05-30 345 views
0

我正在嘗試創建廣告素材,但獲取無效參數錯誤。該異常甚至沒有指定哪個參數錯誤。廣告創意出現錯誤「無效的參數」Facebook營銷API

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

看來你還沒有添加的頁面,創意必須是發佈。我認爲在object_story_spec array中添加AdCreativeObjectStorySpecFields::PAGE_ID => 'your published page id here'可以解決您的問題。

相關問題