我正在使用Facebook API发送应用通知并发出问题。
我有一个脚本,如果他们的邀请被接受,就会向用户发送通知。几乎所有测试的通知都是成功的,但是当有人试图向我(应用程序的开发人员)发送通知时,我收到错误。但只有当Facebook应用程序在开发模式下not
并且我将自己删除为应用程序的开发人员/测试人员时。
问题是我不知道其他用户是否会有这个错误,因为就目前而言,据我所知,只有我收到此错误。
我也无法找到有关错误消息的任何解释。
请帮忙。
这是发送通知的PHP代码
try {
$response = $facebook->api( '/'.$userID.'/notifications', 'POST', array(
'template' => $messageText,
'href' => $link,
'access_token' => $app_access_token
));
} catch (Exception $e) {`
print_r($e);
}
这是抛出的异常:
FacebookApiException Object
(
[result:protected] => Array
(
[error] => Array
(
[message] => (#2) Failed to create notification
[type] => OAuthException
[is_transient] => 1
[code] => 2
)
)
[message:protected] => (#2) Failed to create notification
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /[PRIVATE]/facebook-php-sdk/src/base_facebook.php
[line:protected] => 1340
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /[PRIVATE]/facebook-php-sdk/src/base_facebook.php
[line] => 911
[function] => throwAPIException
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => Array
(
[error] => Array
(
[message] => (#2) Failed to create notification
[type] => OAuthException
[is_transient] => 1
[code] => 2
)
)
)
)
[1] => Array
(
[function] => _graph
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => /[myID]/notifications
[1] => POST
[2] => Array
(
[template] => [PRIVATE]
[href] => [PRIVATE]
[access_token] => [PRIVATE]
)
)
)
[2] => Array
(
[file] => /[PRIVATE]/facebook-php-sdk/src/base_facebook.php
[line] => 687
[function] => call_user_func_array
[args] => Array
(
[0] => Array
(
[0] => Facebook Object
(
[sharedSessionID:protected] =>
[appId:protected] => [PRIVATE]
[appSecret:protected] => [PRIVATE]
[user:protected] => 0
[signedRequest:protected] =>
[state:protected] =>
[accessToken:protected] => [PRIVATE]
[fileUploadSupport:protected] =>
[trustForwarded:protected] =>
[allowSignedRequest:protected] =>
)
[1] => _graph
)
[1] => Array
(
[0] => /[myID]/notifications
[1] => POST
[2] => Array
(
[template] => [PRIVATE]
[href] => [PRIVATE]
[access_token] => [PRIVATE]
)
)
)
)
[3] => Array
(
[file] => /[PRIVATE]
[line] => 22
[function] => api
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => /[myID]/notifications
[1] => POST
[2] => Array
(
[template] => [PRIVATE]
[href] => [PRIVATE]
[access_token] => [PRIVATE]
)
)
)
)
[previous:Exception:private] =>
)