0

I am using MGTwitterEngine + OAuth in my project. I would like to load all tweets from the currently logged in user into a NSMutableArray, however I am having difficulty doing so.

Upon successful login I call the following method:

[_engine getUserTimelineFor:_engine.username sinceID:0 startingAtPage:0 count:20];

And then in the delegate method I have the following:

- (void) statusesReceived:(NSArray *)statuses
               forRequest:(NSString *) connectionIdentifier
{
    for ( NSDictionary *dict in statuses )
    {
        NSLog(@"%@", [dict objectForKey:@"id" ]);
        // tweets is a NSMutableArray previously allocated and initialised
        [tweets addObject:[dict objectForKey:@"id" ]];
    }
    [_engine getUserTimelineFor:_engine.username sinceID:0 startingAtPage:0 count:20];
}

As you can see I am attempting to batch load the current users tweets, 20 at a time.

I believe the issue lies in the fact, I am not incrementing the page parameter. My issue is, I don't understand what a page actually represents, or how to get the total number of pages for any given user.

How can I load all of a users tweets in a simple, and efficient manner?

Mick Walker
  • 3,862
  • 6
  • 47
  • 72

1 Answers1

-1

If you are using tableView to display tweet to user, you can use "Facebook's way". You can show first 20 tweets in the table view and when iPhone user scrolls down and and try to view last tweet (if you are rendering last row of your table view) then send request to get next 20 tweets and so on. So that you don't need to show page numbers and older tweets will get loaded when user wants to view them.

I hope this helps you.

Abhay
  • 118
  • 1
  • 5