Last active
August 29, 2015 14:11
-
-
Save kyleclegg/ae32ea1fc5b19359bea0 to your computer and use it in GitHub Desktop.
CoreData Simple Fetch
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
// Substitute [ACHCoreDataHelper sharedHelper].defaultContext for the managedObjectContext | |
NSEntityDescription *entity = [NSEntityDescription entityForName:@"StickerPack" inManagedObjectContext:[ACHCoreDataHelper sharedHelper].defaultContext]; | |
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; | |
[fetchRequest setEntity:entity]; | |
NSError *error; | |
NSArray *items = [[ACHCoreDataHelper sharedHelper].defaultContext executeFetchRequest:fetchRequest error:&error]; | |
NSLog(@"items: %@", items); | |
StickerPack *pack = items[0]; | |
NSLog(@"pack: %@", pack); | |
NSLog(@"pack stickers: %@", pack.stickers); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment