简体   繁体   中英

Integrate Comments with Facebook iOS SDK (iPhone)

I implemented the Facebook iOS API / SDK into my application and it works fine. 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. Other users should be able to see the previous comments as a list.

I already created a Facebook application on 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 ?

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

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)

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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