“Like” a Page using the Facebook Graph API, Objective C

浪子不回头ぞ 提交于 2019-12-04 07:05:50

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

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.

Mak

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];`

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."

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".

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!