当我们尝试发送给卸载了我们应用的用户时,我们会收到以下错误消息。错误没问题,但我们需要在收到错误后继续发送通知。
关于热的任何想法继续吗?
Message: Hello World
Test Users: 589069632 (uninstalled the app),594917560 (installed the app-he should get the message)
错误代码
FacebookApiException Object
(
[result:protected] => Array
(
[error] => Array
(
[message] => (#200) Cannot send notifications to a user who has not installed the app
[type] => OAuthException
[code] => 200
)
)
[message:protected] => (#200) Cannot send notifications to a user who has not installed the app
[string:Exception:private] =>
[code:protected] => 0
[file:protected] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/facebook/base_facebook.php
[line:protected] => 1238
[trace:Exception:private] => Array
(
[0] => Array
(
[file] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/facebook/base_facebook.php
[line] => 870
[function] => throwAPIException
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => Array
(
[error] => Array
(
[message] => (#200) Cannot send notifications to a user who has not installed the app
[type] => OAuthException
[code] => 200
)
)
)
)
[1] => Array
(
[function] => _graph
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => /589069632/notifications
[1] => POST
[2] => Array
(
[access_token] => 490863990938333|cc281af73699bd0d928672362bd05452
[href] =>
[template] => Hello World
)
)
)
[2] => Array
(
[file] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/facebook/base_facebook.php
[line] => 644
[function] => call_user_func_array
[args] => Array
(
[0] => Array
(
[0] => Facebook Object
(
[sharedSessionID:protected] =>
[appId:protected] => 490863990938333
[appSecret:protected] => cc281af73699bd0d928672362bd05452
[user:protected] =>
[signedRequest:protected] =>
[state:protected] =>
[accessToken:protected] =>
[fileUploadSupport:protected] =>
[trustForwarded:protected] =>
)
[1] => _graph
)
[1] => Array
(
[0] => /589069632/notifications
[1] => POST
[2] => Array
(
[access_token] => 490863990938333|cc281af73699bd0d928672362bd05452
[href] =>
[template] => Hello World
)
)
)
)
[3] => Array
(
[file] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/modules/backend/notification_send.php
[line] => 65
[function] => api
[class] => BaseFacebook
[type] => ->
[args] => Array
(
[0] => /589069632/notifications
[1] => POST
[2] => Array
(
[access_token] => 490863990938333|cc281af73699bd0d928672362bd05452
[href] =>
[template] => Hello World
)
)
)
[4] => Array
(
[file] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/modules/backend/notification_send.php
[line] => 48
[function] => sender
[args] => Array
(
)
)
[5] => Array
(
[file] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/lib/BaseController.php
[line] => 52
[args] => Array
(
[0] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/modules/backend/notification_send.php
)
[function] => include
)
[6] => Array
(
[file] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/lib/BaseController.php
[line] => 22
[function] => setTemplate
[class] => BaseController
[type] => ->
[args] => Array
(
[0] => backend
[1] => notification_send
[2] => Request Object
(
[method:protected] => POST
[queryString:protected] =>
[facebookID] => 589069632,594917560
[notification_app_link] =>
[notification_message] => Hello World
)
)
)
[7] => Array
(
[file] => /home/hurremlekahvefali.com/domains/app.hurremlekahvefali.com/httpdocs/hurrem/index.php
[line] => 72
[function] => dispatch
[class] => BaseController
[type] => ->
[args] => Array
(
[0] => backend
[1] => notification_send
[2] => Request Object
(
[method:protected] => POST
[queryString:protected] =>
[facebookID] => 589069632,594917560
[notification_app_link] =>
[notification_message] => Hello World
)
)
)
)
[previous:Exception:private] =>
)
答案 0 :(得分:1)
如果您尝试向已卸载应用的用户发帖,则会引发异常。
您应该捕获异常并将用户标记为已在数据库中卸载。
然而,这无助于继续通知。
您应该做的三个最佳实践:
这里有一个关于如何管理取消授权的好答案:https://stackoverflow.com/a/4860829/504088