Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
CoreData Simple Fetch
// 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
You can’t perform that action at this time.