“喜欢”使用 Facebook Graph API、Objective C 的页面

发布于 2024-11-08 10:57:57 字数 1053 浏览 0 评论 0原文

我试图允许我的 iOS 应用程序的用户使用以下代码“喜欢”页面:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"access_token",[[NSUserDefaults standardUserDefaults] objectForKey:@"fb_accessToken"], nil];

[facebook requestWithGraphPath:@"PAGE_ID/likes" andParams:params andHttpMethod:@"POST" andDelegate:self];

我收到错误消息:

Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x624d560 {error=<CFBasicHash 0x6243fb0 [0x171e400]>{type = mutable dict, count = 2,
        entries =>
            2 : <CFString 0x624cec0 [0x171e400]>{contents = "type"} = <CFString 0x624bc40 [0x171e400]>{contents = "OAuthException"}
            3 : <CFString 0x624aaf0 [0x171e400]>{contents = "message"} = <CFString 0x6248b50 [0x171e400]>{contents = "(#3) Application does not have the capability to make this API call."}
        }
        }

这应该是图形 API 的一部分,因为它说您可以使用它来“喜欢”任何对象与 /Likes 连接。有什么帮助吗?

I'm trying to allow the user of my iOS app to "Like" a page using the following code:

NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"access_token",[[NSUserDefaults standardUserDefaults] objectForKey:@"fb_accessToken"], nil];

[facebook requestWithGraphPath:@"PAGE_ID/likes" andParams:params andHttpMethod:@"POST" andDelegate:self];

I get the error message:

Error Domain=facebookErrDomain Code=10000 "The operation couldn’t be completed. (facebookErrDomain error 10000.)" UserInfo=0x624d560 {error=<CFBasicHash 0x6243fb0 [0x171e400]>{type = mutable dict, count = 2,
        entries =>
            2 : <CFString 0x624cec0 [0x171e400]>{contents = "type"} = <CFString 0x624bc40 [0x171e400]>{contents = "OAuthException"}
            3 : <CFString 0x624aaf0 [0x171e400]>{contents = "message"} = <CFString 0x6248b50 [0x171e400]>{contents = "(#3) Application does not have the capability to make this API call."}
        }
        }

This should be part of the Graph API because it says you can use that to "Like" any object with a /Likes connections. Any help?

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

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

发布评论

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

评论(5

独孤求败 2024-11-15 10:57:57

很抱歉带来坏消息,但显然您不能代表用户喜欢某个页面。但是,您可以代表用户对帖子、评论和照片进行点赞。

希望这是有道理的,我在过去的几个小时里一直在尝试做模拟。

富有的

Sorry to be the bearer of bad news, but apparently You can't like a Page on behalf of a user. You can, however, like posts, comments, and photos on behalf of a user.

Hope this makes sense, I've spent the last few hours trying to do simular.

Rich

九局 2024-11-15 10:57:57

这似乎最近发生了变化,但现在有一个新的 API - 请参阅 https: //developers.facebook.com/docs/opengraph/actions/builtin/likes/ 了解详细信息。

This appears to have recently changed, but now there is a new API - see https://developers.facebook.com/docs/opengraph/actions/builtin/likes/ for details.

绝不放开 2024-11-15 10:57:57

https://developers.facebook.com/docs/reference/rest/stream。 addLike/

并对帖子点赞

NSMutableDictionary* dict = [[[NSMutableDictionary alloc]initWithObjectsAndKeys:PostId,@"post_id",nil]autorelease];

[AppDelegate.facebook requestWithMethodName:@"stream.addLike" andParams:dict andHttpMethod:@"POST"  andDelegate:self];

并删除点赞

NSMutableDictionary* dict = [[[NSMutableDictionary alloc]initWithObjectsAndKeys:PostId,@"post_id",nil]autorelease];

[AppDelegate.facebook requestWithMethodName:@"stream.removeLike" andParams:dict andHttpMethod:@"POST"  andDelegate:self];`

https://developers.facebook.com/docs/reference/rest/stream.addLike/

and like a post

NSMutableDictionary* dict = [[[NSMutableDictionary alloc]initWithObjectsAndKeys:PostId,@"post_id",nil]autorelease];

[AppDelegate.facebook requestWithMethodName:@"stream.addLike" andParams:dict andHttpMethod:@"POST"  andDelegate:self];

and remove like

NSMutableDictionary* dict = [[[NSMutableDictionary alloc]initWithObjectsAndKeys:PostId,@"post_id",nil]autorelease];

[AppDelegate.facebook requestWithMethodName:@"stream.removeLike" andParams:dict andHttpMethod:@"POST"  andDelegate:self];`
最笨的告白 2024-11-15 10:57:57

Eric Kassan 链接的页面的第二段指出:“og.likes 操作可以引用任何开放的图形对象或 URL,Facebook 页面或照片除外。”

The second paragraph of the page linked by Eric Kassan states that: "The og.likes action can refer to any open graph object or URL, except for Facebook Pages or Photos."

迷途知返 2024-11-15 10:57:57

我花了10个小时来解决这个问题。

但不幸的是,没有办法……即使他们在“喜欢”图形 API 中说了“任何对象”,但它仅限于“用户,它是帖子、评论和照片”。

I have spent 10 hours for this solution.

But unfortunfortunitly there is not way.. even they have said "any object" in "likes" graph api but it's limited to only "users, it's posts, comments and photos".

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