简体   繁体   English

将评论与Facebook iOS SDK(iPhone)集成

[英]Integrate Comments with Facebook iOS SDK (iPhone)

I implemented the Facebook iOS API / SDK into my application and it works fine. 我在应用程序中实现了Facebook iOS API / SDK,并且运行良好。 I'm eg able to read the name of the logged in user etc. 例如,我能够读取已登录用户的名称等。

So the question: 所以问题是:

I have several view Controllers with videos in it. 我有几个带有视频的视图控制器。 The user is logged in with his Facebook account and should be able to post a comment or like the video. 用户使用他的Facebook帐户登录,应该可以发表评论或观看视频。 Other users should be able to see the previous comments as a list. 其他用户应该可以看到以前的评论作为列表。

I already created a Facebook application on Facebook.com . 我已经创建了一个Facebook应用程序Facebook.com

What should I do next? 接下来我该怎么办? Do I have to do create some "lists" on Facebook.com which I can GET and display via the Facebook API ? 我是否必须在Facebook.com上创建一些“列表”,然后才能通过Facebook API进行GET和显示?

Thank you 谢谢

NSMutableDictionary *res = [NSMutableDictionary dictionaryWithObjectsAndKeys:@"This is my comment", @"message", YOUR ACCESS TOKEN,@"access_token",nil];
[FBRequestConnection startWithGraphPath:[NSString stringWithFormat:@"%@/comments",PHOTO'S ID] parameters:res HTTPMethod:@"POST" completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
    if (error)
    {
        NSLog(@"error: %@", error.localizedDescription);
    }
    else
    {
        NSLog(@"ok!! %@",result);
    }
}];

Check out this tutorial for facebook on iphone 在iPhone上查看Facebook的本教程

EDIT : Ok, about the list I think it will be best if you store it in the user's device (or preferably a remote database) because keeping track of user comments specific to your application through facebook is too cumbersome (I am not familiar with FB API which returns a list of comments for a specific app so check that as well) 编辑:好的,关于列表,我认为将其存储在用户设备(最好是远程数据库)中是最好的,因为通过Facebook跟踪特定于您的应用程序的用户注释太麻烦了(我不熟悉FB API,该API返回特定应用的评论列表,因此也请进行检查)

Posting to the User's Wall is easy and well explained here (Goto "Posting to the User's Wall" somewhere in the middle of the page). 在此处张贴到用户的墙壁很容易,并且得到了很好的解释(转到页面中间某处的“张贴到用户的墙壁”)。

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

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