Facebook API错误消息'(#100)尝试在节点类型(页面)上访问不存在的字段(adaccounts)

时间:2016-06-23 12:19:50

标签: php facebook

我收到了错误:

致命错误:未捕获的异常'FacebookAds \ Http \ Exception \ AuthorizationException',带有消息'(#100)尝试访问节点类型(页面)上的不存在字段(adaccounts)'

尝试使用Facebook营销API时。

这是我的代码:(我在#是的地方得到了正确的值。

<!DOCTYPE HTML>

<html lang = "en">

<head>

<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title> Home </title>

</head>

<body>

    <script>
      window.fbAsyncInit = function() {
        FB.init({
          appId      : '#',
          xfbml      : true,
          version    : 'v2.6'
        });
      };

      (function(d, s, id){
         var js, fjs = d.getElementsByTagName(s)[0];
         if (d.getElementById(id)) {return;}
         js = d.createElement(s); js.id = id;
         js.src = "//connect.facebook.net/en_US/sdk.js";
         fjs.parentNode.insertBefore(js, fjs);
       }(document, 'script', 'facebook-jssdk'));
    </script>

<?php

require_once('vendor/autoload.php');

use FacebookAds\Api;
use FacebookAds\Object\AdUser;
use FacebookAds\Object\AdAccount;

// Initialize a new Session and instanciate an Api object
Api::init("#", "#", "#");

// The Api object is now available trough singleton
$api = Api::instance();


$me = new AdUser('me');
$my_adaccount = $me->getAdAccounts()->current();

print_r($my_adaccount->getData());


?>






















</body>


</html>

0 个答案:

没有答案