FB and Twitter feed in ios application

i want to create global feed for user from FB and Twitter, so i'm using FB-iOS-SDK and TwitterSdk for this. I'm getting both feeds as NSArrays (of dictionaries of course) and now i want to load the last 10 posts by user from both feeds (ordered by time). For example:

1)Post from twitter - 04.07.14 10:05 PM

2) Post from twitter - 04.07.14 09:12 PM

3) Post from facebook - 04.07.14 10:13 AM

4) Post from twitter - 03.07.14 11:15 AM

I have methods:

- (void)twitterTimeline:(NSString *)maxid :(NSString *)screename :(NSInteger *)count

-(void)fbWall: (NSString *)maxid :(NSString *)screenname :(NSInteger *)count

screenname-username maxid-number to skip from last post count-count of post

But i don't know what is the best way to organize this data? I just need a simple TableView with this data so when i'm scrolling down i can get more and more news (increase maxid parameter).

I do not ask you how to programmatically accomplish this, I just need some advice how to do it better (combine two arrays into one or something else)


Your question is not very specific so I'm going to assume you want a way to store both types of posts in one list. There are a few clean ways to do this.

  1. Have 2 separate class types that both conform to a protocol which contains the properties and methods they both need to have (id, screen name, timestamp, post, etc).

  2. If all the fields are going to be the same with no Facebook or Twitter specific fields, you can have a single Post class that you use for both, with perhaps a simple enum flag indicating the "type" to be Facebook or Twitter.

  3. Have a base class with all shared fields (like the ones you would have in the protocol from the first item), and a subclass for each type of post.


Once you have all the posts in your array, just sort the array on the timestamp (see how to sort by NSDate here). Then you can just grab the first 10 elements and put them in a new array or do whatever you want with them.

Need Your Help

What would be a good implementation to get all Monday and Thursday dates Between a given date range (DateX and DateY) in JAVA

java date range

I have this issue. I want to get some days between a date range given. What would be an optimal solution for this? for example I want to get all Monday, Wednesday and Thursday dates from today up t...