通过 facebook api 将封面上传到事件会引发异常 [英] Uploading a cover to an event through the facebook api throws an Exception

查看:25
本文介绍了通过 facebook api 将封面上传到事件会引发异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我曾经能够使用这篇文章中描述的方法通过 http 帖子将封面照片上传到 Facebook 活动:Facebook PHP SDK:上传活动封面照片

I used to be able to upload cover photos to facebook events through http posts using the method described in this post: Facebook PHP SDK: Upload Event Cover Photo

它最近停止工作,事件已创建,但封面将不再上传,图表在我尝试时给出以下响应:

It stopped working recently, the event is created but the cover won't upload anymore, with the graph giving the following response at my attempts:

"{"error":{"type":"Exception","message":"用户无权将此照片附加到另一个对象.","code":1366035}}"

在处理封面图片时,facebook 文档很少,我找不到任何提及此特定错误代码的内容.

The facebook documentation is scarce when it comes to handling cover images and I can't find any mention of this specific error code.

以前有人遇到过这个问题吗?

Has anyone come by this issue before?

推荐答案

我在使用 user_token 将事件和封面添加到页面时遇到了同样的问题.我的解决方法是使用该 user_token 获取 page_token,然后使用 page_token 创建事件和封面.

I had the same issue using user_token to add event and cover into page. My workaround is to get page_token using that user_token, and then create event and cover using page_token.

$fb->setAccessToken($user_token); //set your user token

$result = $fb->api($page_id.'?fields=access_token', 'get');

if(isset($result["access_token"])) //this will be set if your user has a permission on the page.
{
    $page_token = $result["access_token"]; 
    $fb->setAccessToken($page_token); 
}

//create event add cover as before

这篇关于通过 facebook api 将封面上传到事件会引发异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆