简体   繁体   English

iPhone facebook 集成

[英]iPhone facebook integration

I am using Graph API in my application.我在我的应用程序中使用 Graph API。 I am fetching user's facebook wall feeds using graph API also getting details of particular post ie (Like count,Comments etc).我正在使用图形 API 获取用户的 facebook 墙馈送,还获取特定帖子的详细信息,即(如计数、评论等)。 but i want to allow user to Like and Comment any post from the application itself.但我想允许用户喜欢和评论应用程序本身的任何帖子。 what is the request format for that?什么是请求格式?

Please help me or give any pointers.请帮助我或提供任何指示。

Regards, Sanket问候, Sanket

You would be well served to check out the Publishing section of the documentation .您可以查看文档发布部分。 It provides information such as this.它提供诸如此类的信息。

One example is liking, which is defined as:一个例子是喜欢,它被定义为:

Method: /OBJECT_ID/likes方法:/OBJECT_ID/likes

Description: Like the given object (if it has a /likes connection)描述:像给定的 object(如果它有 /likes 连接)

Arguments: none Arguments:无

Basically, just initiate a Graph API call to something like:基本上,只需启动 Graph API 调用,例如:

[facebookObject requestWithGraphPath:@"98423808305/likes" andDelegate:self];

That will "like" a picture from Coca-Cola (ID taken from the documentation).这将“喜欢”可口可乐的图片(ID 取自文档)。


Edit 1编辑 1

According to the documentation:根据文档:

Most write operations require extended permissions for the active user.大多数写入操作都需要活动用户的扩展权限 See the authentication guide for details on how you can request extended permissions from the user during the authentication step.有关如何在身份验证步骤中向用户请求扩展权限的详细信息,请参阅身份验证指南

Are you sure you have enough privileges?你确定你有足够的特权吗? Unfortunately the documentation is very unclear as to whether it serves the dual purpose of liking the object and returning the likes already on that object.不幸的是,文档还不清楚它是否具有喜欢 object 和返回 object 上的喜欢的双重目的。


Edit 2编辑 2

I did some more research into what could be causing this and came across this question and answer that indicated that the code I posted above using requestWithGraphPath:: should work.我对可能导致此问题的原因进行了更多研究,并遇到了这个问题和答案,表明我上面使用requestWithGraphPath::发布的代码应该可以工作。 However, it does not due to a bug on Facebook's Bug Tracker .但是,这并不是因为Facebook 的 Bug Tracker 上的错误

Unfortunately, it looks like there is no way to "like" an object via the Graph API, which seems very strange to me.不幸的是,似乎没有办法通过图表 API “喜欢” object,这对我来说似乎很奇怪。 Perhaps it is possible with the legacy REST API instead of the Graph API?也许可以使用旧版 REST API 而不是图 API?


Edit 3编辑 3

Well, it looks like your best bet is the stream.addLike method of the legacy REST API which you can still call using the Facebook iOS SDK. Well, it looks like your best bet is the stream.addLike method of the legacy REST API which you can still call using the Facebook iOS SDK. You should be able to use the stream.addLike method to "like" something in the "stream".您应该能够使用stream.addLike方法来“喜欢”“流”中的某些内容。 Unfortunately, it doesn't appear to support photos, videos, etc. Only posts and comments.不幸的是,它似乎不支持照片、视频等。仅支持帖子和评论。

Finally i found the solution for LIKE option We should use following method for like option.最后我找到了 LIKE 选项的解决方案我们应该使用下面的方法来选择类似的选项。

-(void) requestWithGraphPath:(NSString *)graphPath 
               andParams:(NSMutableDictionary *)params 
           andHttpMethod:(NSString *)httpMethod 
             andDelegate:(id <FBRequestDelegate>)delegate

graphPath = /OBJECT_ID/likes Paramas = dictionary with comment,for like option use empty dictionary HttpMethod should be POST graphPath = /OBJECT_ID/likes Paramas = 带注释的字典,对于like 选项使用空字典 HttpMethod 应该是 POST

you should get response = true if the LIKE request is successful.如果 LIKE 请求成功,您应该得到 response = true。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM