I'm sure there are at least 100000 iphone apps that try to do what I need.
Our iPhone app show web pages (articles) in UIWebView. Each article has Facebook Comments Social Plugin in the Desktop version. On the iPhone app I want to show the comments and allow the user to add a comment of his own with the native access-token (meaning, no need to connect again via web).
Why is this simple and basic function is so complicated??
In the app the user passes Facebook Login so I have the access-token. I'm aware of the option to show the the Social Plugin in the mobile version, but in this case there is no option to make use of the access token.
Another option I walked through is to use the Facebook Graph API, but in this case I'm not sure:
Please help...
You can fetch the first page of comments like this:
NSDictionary *params = @[@"ids" : pageId];
self.connection =
[FBRequestConnection
startWithGraphPath:@"comments"
parameters:params
HTTPMethod:@"GET"
completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
// ...
}];
where pageId is the URL of the the web page containing the social plugin. Comments are returned as JSON. This response includes a URL for fetching the next page, which you can fetch like so:
FBRequest *fbRequest = [[FBRequest alloc] initWithSession:[FBSession activeSession]
graphPath:nil];
FBRequestConnection *connection = [[FBRequestConnection alloc] init];
[connection addRequest:fbRequest completionHandler:^(FBRequestConnection *connection, id result, NSError *error) {
// ...
}];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:moreCommentsURL];
connection.urlRequest = request;
[connection start];
You'll have to build your own solution for displaying these comments.