Ian Hewitt
Ian Hewitt

Reputation: 51

Facebook iOS SDK 3.2 get users news feed

I'm trying to use the Facebook SDK 3.2 in my iOS app to get the users facebook news feed. I've successfully got the native facebook login to work and requested the extended read permission.

I guess looking at the documentation I need to use the FBRequest and FBRequestConnection classes but I can't find any examples of this sort of thing on the facebook developer site, at least not enough for me to confidently go on. Must say the tutorials on the facebook dev site aren't as good as they used to be!

Could someone help me out with an example?

Upvotes: 3

Views: 2865

Answers (1)

EDIT : FQL is deprecated (since 2.0), we should now use the Graph API. The link provided at the bottom of this post shows valuable information, see the red Alert at the top of the screen once you get there.

You will need the "read_stream" permission. Then use FQL to get the news feed.

I'm doing it like this:

NSString *fqlQuery = @"SELECT post_id, created_time,  type, attachment FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed')AND is_hidden = 0 LIMIT 300";

// Make the API request that uses FQL
[FBRequestConnection startWithGraphPath:@"/fql"
                             parameters:[NSDictionary dictionaryWithObjectsAndKeys: fqlQuery, @"q", nil]
                             HTTPMethod:@"GET"
                      completionHandler:^(FBRequestConnection *connection,
                                          id result,
                                          NSError *error) 
                      {
                          if (error)
                              NSLog(@"Error: %@", [error localizedDescription]);
                          else
                              NSLog(@"Result: %@", result);               
                      }];

For more infomation look here: http://developers.facebook.com/docs/reference/fql/stream

Upvotes: 2

Related Questions