如何通过 FBconnect 或 iPhone SDK 中的 Graph API 评论或喜欢 Facebook 中的照片? [英] How to comment or like a photo in facebook through FBconnect or Graph API in iPhone SDK?
问题描述
我正在开发一个 iPhone 应用程序,我想在其中评论或喜欢 Facebook 上的照片.
I am developing a iPhone application in which I want to Comment or Like a Photo on Facebook.
对于 Facebook 集成,我使用 FBConnect 和 Graph API.
For Facebook integration I am using FBConnect and Graph API.
我在我的应用程序中的墙上收到朋友的照片,现在我想通过我的 iPhone 应用程序点赞或评论它们.
I am getting friends Photos on my wall in my application, now I want to Like or Comment on them through my iPhone Application.
请建议我如何获得它.
提前致谢.
推荐答案
要喜欢"一张照片(或其他带有 ID 的东西),只需将您的 Access-Token 发布到 Graph API,例如您的照片 ID 为 123456789.因此您必须将您的访问令牌发布到 https://graph.facebook.com/123456789/likes.
To "Like" a Photo (or everthing else with an ID) just post your Acces-Token to the Graph API, e.g. your photo has the ID 123456789. So you have to post your Access-Token to https://graph.facebook.com/123456789/likes.
要对照片发表评论,请执行相同的操作,但将消息(作为参数)发布到 Graph API,例如https://graph.facebook.com/123456789/comments.
To comment on a Photo do the same, but post a message (as a parameter) to the Graph API, e.g. https://graph.facebook.com/123456789/comments.
在代码中调用以下方法(在 Facebook.h 中定义),使用您的路径,没有Like"参数和一条消息作为Comment"参数:
In Code call the following method (defined in Facebook.h) with your path and no parameters for "Like" and a message as a parameter for "Comment":
-(void) requestWithGraphPath:(NSString *)graphPath
andParams:(NSMutableDictionary *)params
andHttpMethod:(NSString *)httpMethod
andDelegate:(id <FBRequestDelegate>)delegate
请注意,httpMethod 应为POST",并且 Facebook iOS SDK 会自动添加您的访问令牌.
Note, that the httpMethod should be "POST" and the Facebook iOS SDK automaticaly adds your Access-Token.
有关更多信息,请阅读以下发布"部分:http://developers.facebook.com/docs/reference/api
For more information read the "Publishing" part on: http://developers.facebook.com/docs/reference/api
就像 deanWombourne 在评论中写的一样:只需像这样发布 NSMutableDictionary
Like deanWombourne wrote in the comments: Just post an NSMutableDictionary like this
[NSMutableDictionary dictionaryWithObjectsAndKeys:@"This is my comment", @"message", nil];
对于评论或空的 NSMutableDictionary 像:
for the comments or an empty NSMutableDictionary like:
[NSMutableDictionary dictionary]
如果你想给一个帖子点赞.
if you want to like a post.
来自 Facebook 服务器的响应应该是 result = true.
The response from the Facebook servers should be result = true.
这篇关于如何通过 FBconnect 或 iPhone SDK 中的 Graph API 评论或喜欢 Facebook 中的照片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!