Created
November 27, 2009 17:47
-
-
Save quique123/244142 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-(void)synchronousLoadTwitterData{ | |
// Beause this is ran inside a seprate thread we have to be real careful | |
// that the data we play with here doesn't clobber another thread that is | |
// running at the exact same time. We will build a temprary array that we | |
// will assign the instance variable to only on the main thread. | |
// setup the tweet array and log it ONCE | |
publicTweets = [[NSMutableArray alloc]init]; | |
// this needs to be a new operation so as not to block the main thread... | |
NSArray *userTimeline = [[NSArray alloc] initWithArray:[TwitterHelper fetchPublicTimeline]]; | |
for ( int i = 0 ; i< [userTimeline count]; i++) { | |
[publicTweets addObject:[[userTimeline objectAtIndex:i] objectForKey:@"text" ]]; | |
NSLog(@"Tweets %@ DFLTDWR", publicTweets); | |
NSLog(@"==============>Timeline Array at index %d Status Msg:%@", i, [[userTimeline objectAtIndex: i] objectForKey:@"text" ]); | |
} | |
[self performSelectorOnMainThread:@selector(didFinishLoadingTwitterDataWithResults:) withObject:publicTweets waitUntilDone:NO]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment