Skip to content

Instantly share code, notes, and snippets.

@quique123
Created February 25, 2010 21:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quique123/315056 to your computer and use it in GitHub Desktop.
Save quique123/315056 to your computer and use it in GitHub Desktop.
-(void)synchronousLoadFlickrData{
NSLog(@"BEGINLOADINGflickr dictionary");
PaparazziAppDelegate *appDelegate= (PaparazziAppDelegate *)[[UIApplication sharedApplication] delegate];
// GET PLIST FILE INFO
filePath = [[NSBundle mainBundle] pathForResource:@"FakeData" ofType:@"plist"];
if (filePath)
{
// CREATE FLICKR ARRAY FROM PLIST FILE PATH
NSArray *twitterIds = [NSArray arrayWithContentsOfFile:filePath];
for (NSDictionary *dict in twitterIds)
{
// Step 1: Create Object
Photo* newPhoto = (Photo*)[NSEntityDescription insertNewObjectForEntityForName:@"Photo" inManagedObjectContext:managedObjectContext];
// Step 2: Set Properties
NSLog(@"Entering Photo Name:%@",[dict objectForKey:@"name"]);
[newPhoto setPhotoName:[dict objectForKey:@"name"]];
NSLog(@"SettingPhotoURL:%@",[dict objectForKey:@"path"]);
[newPhoto setPhotoURL:[dict objectForKey:@"path"]];
NSLog(@"SettingOwnerName:%@",[dict objectForKey:@"user"]);
[newPhoto setOwnerName:[dict objectForKey:@"user"]];
}
// Step 3: Save Object
[appDelegate saveAction];
}
}
[self performSelectorOnMainThread:@selector(didFinishLoadingFlickrDataWithResults:) withObject:nil waitUntilDone:NO];
NSLog(@"leaving synchronousLoadFlickrData");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment