I am making an iPhone app in which Facebook post sharing option is available. Now I want to show all the likes and comments of that post. I know that we can do it through http://graph.facebook.com/post_id/comments . Now can you tell me how to get the post_id
of my post or shared link?
Thanks.
When you post anything on facebook. In your
- (void)request:(FBRequest *)request didLoad:(id)result
method you will get the result.. Just print that result. You will get the post_id if you are using FB SSO
Assuming your app posts to the me/feed endpoint, using the Facebook SDK 3.1 you can set up a completion handler to grab the post id:
[FBRequestConnection
startWithGraphPath:@"me/feed"
parameters:self.postParams
HTTPMethod:@"POST"
completionHandler:^(FBRequestConnection *connection,
id result,
NSError *error) {
if (error) {
// Handle error
} else {
NSString *postId = [result objectForKey:@"id"];
}
}];
See: https://developers.facebook.com/docs/howtos/publish-to-feed-ios-sdk/ for an example of how to post.
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.