1

I'm trying to integrate a custom view which shows a few post of the users Facebook news feed.

I'm looking for a good starting point. I don't want to use a UIWebView or something like this to grab the mobile site of Facebook instead I want to get data in JSON format or similar and display it in a custom fashion.

Can you give me any advice or links to tutorials how i can get the Facebook news feed data?

Edit: I want to update my requirements. I looked a bit into the Facebook Documentation and the SDK. There are some Sample Codes which are useful but I'm missing a straight forward tutorial or sample which does fetch the users newsfeed and displays it. This is why I made the bounty.

I will give the +100 Rep for somebody that creates a sample or tutorial which does get posts of the users newsfeed. Required would be: Get the name of the poster, message, timestamp and attached image. It would be nice if you also show them in a uiview but it is not required. If there is an existing framework feel free to link it.

I'm working myself on something similar and will publish it too. I think this could be tribute to the community.

henrywright
  • 10,070
  • 23
  • 89
  • 150
arnoapp
  • 2,416
  • 4
  • 38
  • 70

5 Answers5

2

I have created a sample starter project that gets the user's facebook newsfeed and displays it. It shows who did the post, the poster's profile picture, and when it was posted along with the message.

It is fairly rudimentary and could use some enhancement from other developers, i.e. endless scrolling, displaying any links, likes or recognizing URLs, etc.

https://github.com/AaronBratcher/UserFeed

Aaron Bratcher
  • 6,051
  • 2
  • 39
  • 70
1

I would integrate the Facebook API on my project, and then you can have access of many informations available on Facebook.

A good start point is read the documentation that you can find here: https://developers.facebook.com

It's not hard to understand, but it has a lot of information!

Good luck.

scollaco
  • 947
  • 8
  • 13
1

At first, you need "read_stream" permission for your app. Then read Facebook Query Language (FQL) Reference https://developers.facebook.com/docs/reference/fql/

To get the Newsfeed you can use the following code:

NSString *fqlString = @"SELECT * FROM stream WHERE filter_key IN (SELECT filter_key FROM stream_filter WHERE uid=me() AND type='newsfeed') AND is_hidden=0 LIMIT <YOUR_LIMIT>";

[FBRequestConnection startWithGraphPath:@"/fql"
                     parameters: @{@"q": fqlString}
                     HTTPMethod:@"GET"
                     completionHandler:^(FBRequestConnection *connection, id result, NSError *error) 
                     {
                          <ANALYZE RESPONSE>
                     }];
malex
  • 9,874
  • 3
  • 56
  • 77
1
  1. Facebook API / SDK Request Wrapper
  2. News feed post class
  3. Simple UI to test the code

Getting Started:

facebook-sdk-posting-to-user-news-feed

Sample App

codercat
  • 22,873
  • 9
  • 61
  • 85
0

To my knowledge you cannot obtain News Feed data in your application. stream table shows only the posts that have appeared on your wall. To create a News Feed for a user Facebook uses his own private algorithm (it was Facebook Edgerank, but read that recently they had changed this algorithm to a new one).

To my point of view, to achieve your goal you can crawl data of all your friends and try to create an algorithm that will range these posts similar to the way it is done by Facebook.

Yury
  • 20,618
  • 7
  • 58
  • 86
  • I'm aware that I can't replicate what Facebook displays on a users newsfeed but what I want to achieve is to get the latest x posts from a users news feed - from what I tested so far this is possible using the fql language – arnoapp Jan 14 '14 at 16:16
  • Let me understand. There are two main sources: news feed (is what you see when you open Facebook) and your wall (the content that appears on your wall, when your friends post there, mark you a photo with you, etc.) You say that you can obtain the data from news feed using fql. To my knowledge this is impossible. The only possibility is to manually collect all the data from the walls of all your friend (using fql stream table for all your connections). Can you show an example how you can do this? – Yury Jan 14 '14 at 22:34
  • 1
    I currently use this query: SELECT post_id, actor_id, message, created_time FROM stream WHERE filter_key in (SELECT filter_key FROM stream_filter WHERE uid = me() AND type = 'newsfeed') ORDER BY created_time DESC LIMIT 5 – arnoapp Jan 14 '14 at 22:51
  • Ok. I agree. I see the results that are similar to facebook news feed. Thank you for opening eyes for me. – Yury Jan 14 '14 at 23:13
  • In fact I've not tested it enough to say it covers everything but I would say it does the most – arnoapp Jan 14 '14 at 23:22