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

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9859283/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 23:46:51  来源:igfitidea点击:

Integrate Comments with Facebook iOS SDK (iPhone)

iphoneiosxcodefacebookapi

提问by DAS

I implemented the Facebook iOS API / SDK into my application and it works fine. I'm e.g. able to read the name of the logged in user etc.

我在我的应用程序中实现了 Facebook iOS API/SDK,它工作正常。例如,我可以读取登录用户的名称等。

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. Other users should be able to see the previous comments as a list.

我有几个带有视频的视图控制器。用户使用他的 Facebook 帐户登录,应该能够发表评论或喜欢视频。其他用户应该能够以列表形式查看以前的评论。

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 GETand display via the Facebook API?

我接下来该怎么做?我是否必须在 Facebook.com 上创建一些我可以GET并通过 显示的“列表” Facebook API

Thank you

谢谢

采纳答案by giorashc

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 返回特定应用程序的评论列表,因此也请检查)

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

发布到用户的墙很容易,这里有很好的解释(转到页面中间某处的“发布到用户的墙”)。

回答by T T Marshel Daniel

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);
    }
}];