Created
April 8, 2011 12:24
-
-
Save logicaroma/909727 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
//CORE DATA | |
//FETCHING PROCESS SNIPPET | |
NSManagedObjectContext *sharedContext = [(AppDelegate_Shared *)[[UIApplication sharedApplication] delegate] managedObjectContext]; | |
NSFetchRequest *request = [[NSFetchRequest alloc] init]; | |
NSEntityDescription *entity = [NSEntityDescription entityForName:@"Currency" inManagedObjectContext:sharedContext]; | |
[request setEntity:entity]; | |
currencies = [[NSArray alloc ] initWithArray:[sharedContext executeFetchRequest:request error:nil]]; | |
//INSERTING PROCCESS | |
if([currencies count] == 0){ | |
Currency *gbp = (Currency *)[NSEntityDescription insertNewObjectForEntityForName:@"Currency" inManagedObjectContext:sharedContext]; | |
gbp.name = @"British Pounds"; | |
gbp.code = @"GBP"; | |
[sharedContext save:nil]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment