Sort through the graphical API of the Facebook page on iOS

I use:

if ([FBSDKAccessToken currentAccessToken]) { [[[FBSDKGraphRequest alloc] initWithGraphPath:@"/v2.3/ID/feed" parameters:nil] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { if (!error) { NSLog(@"fetched user:%@", result); } }]; } 

This gives me a JSON string from ALL data (AND I MEAN ALL) from the Facebook page. He gives me messages, identifiers of those who like messages, every comment, every person who shared. I really need the record itself, which is indicated as a "message" as a result of JSON. Is there a way to do this in an API call, or does it need to be done after?

Also, is there a way to get it to pull out the images associated with each message? I know how to get photos posted on a page, but I just want to view the messages taken on the page and make them also pull up the image.

+8
json ios facebook facebook-graph-api
source share
3 answers

You can filter the feed response as shown below.

 if ([FBSDKAccessToken currentAccessToken]) { [[[FBSDKGraphRequest alloc] initWithGraphPath:@"/v2.3/ID/feed" parameters:[NSMutableDictionary dictionaryWithObject:@"id, message, link.picture" forKey:@"fields"]] startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { if (!error) { NSLog(@"fetched user:%@", result); } }]; } 

As you can check, I mentioned the parameters that I need to get the filter.
NOTE. . You can filter things according to your requirements.
Please see the link below for the available filter features in the facebook SDK.
https://developers.facebook.com/docs/graph-api/reference/v2.3/user/feed
I hope this helps you, Not sure about the picture you want to pull up, but maybe the “link.picture” in the “fields” will help you get the image you want to get.

+4
source share

Use

 /{page_id}/feed?fields=id,message 

With Graph API v2.4, this will be the standard use that you must specify for each field.

+4
source share

this, this is the NSString "link" variable you want:

 if ([FBSDKAccessToken currentAccessToken]) { FBSDKGraphRequest *request = [[FBSDKGraphRequest alloc] initWithGraphPath:@"me" parameters:nil]; [request startWithCompletionHandler:^(FBSDKGraphRequestConnection *connection, id result, NSError *error) { if (!error) { NSDictionary *userData = (NSDictionary *)result; NSString *facebookID = userData[@"id"]; NSString *link = userData[@"link"]; NSString *locale = userData[@"locale"]; NSString *timezone = userData[@"timezone"]; NSString *last_name = userData[@"last_name"]; NSString *email = userData[@"email"]; NSString *gender = userData[@"gender"]; NSString *first_name = userData[@"first_name"]; } else if (error) { //tbd } }]; } else if (![FBSDKAccessToken currentAccessToken]) { //tbd } 
+1
source share

All Articles