是否可以“喜欢”? “粉丝页面”使用 Facebook SDK?

发布于 2024-10-21 12:17:43 字数 752 浏览 1 评论 0原文

我试图让用户在 Android 应用程序中“喜欢”Facebook 粉丝页面。我能够使用这样的代码成功地“喜欢”诸如墙上评论之类的对象,

mFacebook = new Facebook(APP_ID);   
SessionStore.restore(mFacebook, this);        

mAsyncRunner = new AsyncFacebookRunner(mFacebook);
Bundle parameters = new Bundle();
mAsyncRunner.request(COMMENT_ID + "/likes", parameters, "POST", new MyRequestListener(), "");

但是,如果我输入页面 id 而不是评论 id,我会在 Facebook 响应中收到此错误消息,

Response: {"error":{"type":"OAuthException","message":"(#200) App does not have permission to make this call"}}

我同时获得了“publish_stream” " 和 "offline_access" 登录时的发布权限,并通过 SessionStore.restore() 将它们赋予 Facebook 对象。

1) Facebook 是否允许应用程序“点赞”粉丝页面?

2)如果是这样,对我做错了什么有什么想法吗?

谢谢, 马特

I am trying to let users "like" a Facebook fan page from within an Android app. I am able to successfully "like" objects such as wall comments using code like this,

mFacebook = new Facebook(APP_ID);   
SessionStore.restore(mFacebook, this);        

mAsyncRunner = new AsyncFacebookRunner(mFacebook);
Bundle parameters = new Bundle();
mAsyncRunner.request(COMMENT_ID + "/likes", parameters, "POST", new MyRequestListener(), "");

However, if I put in a page id rather than a comment id, I get this error message in the Facebook response,

Response: {"error":{"type":"OAuthException","message":"(#200) App does not have permission to make this call"}}

I am obtaining both the "publish_stream" and "offline_access" publishing permissions at login, and they are given to the Facebook object with SessionStore.restore().

1) Does Facebook let apps "like" fan pages?

2) If so, any ideas on what I am doing wrong?

Thanks,
Matt

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

德意的啸 2024-10-28 12:17:43

Facebook 主页文档已更新并且是最新的(请参阅 https://developers.facebook.com/docs/参考/api/页面/)。即使您可以读取点赞计数信息,您也无法通过 Graph API 点赞页面。

The Facebook documentation for Pages has been updated and is current (see https://developers.facebook.com/docs/reference/api/page/). You cannot like a Page via the Graph API, even though you can read the like count information.

时光瘦了 2024-10-28 12:17:43

正如其他答案所说,不可能通过 Graph API 来“喜欢”页面。

这个主题中的混乱来自 API 文档,其中说 You can comment on or like any object that has a /comments或 /likes 连接(这里的关键术语是连接

更深入一点:
任何对象(在本例中为页面)都具有许多字段和连接。字段基本上用于访问对象信息,连接用于在该对象中执行操作。

总之,一个页面没有 /likes 连接,但它有一个 /likes 字段,这就是为什么我们可以获得给定页面的喜欢数量,但我们无法喜欢一个页面。

As other answers say, it is not possible to 'like' pages via the Graph API.

The confusion in this topic comes from the API documentation, where is says You can comment on or like any object that has a /comments or /likes connection (The key term here is connection)

Going a little deeper:
Any object (in this case a Page), has a number of Fields and Connections. Fields are basically used to access the object information and Connections are used to perform operations in that object.

In sum, a Page doesn't have a /likes Connection, but it has a /likes Field, reason why we can get the number of likes of a given page, but we cannot like a page.

怪我太投入 2024-10-28 12:17:43

不幸的是,据我所知,到目前为止,您无法通过 API 为 Pages 点赞。您可以通过网络视图呈现“赞”按钮,但我认为您至少在这里运气不佳。您可以(正如您所注意到的)喜欢评论和帖子,但页面仍然需要直接的用户交互。

Unfortunately, as far as I know so far, you can't like Pages via the API. You can render a Like button via a web view, but I think you're out of luck here at least. You can (as you note) like comments and posts, but pages still require direct user interaction.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文