What changes in Core Data after a save?
Posted
by Splash6
on Stack Overflow
See other posts from Stack Overflow
or by Splash6
Published on 2010-03-18T06:34:55Z
Indexed on
2010/03/18
18:21 UTC
Read the original article
Hit count: 283
I have a Core Data based mac application that is working perfectly well until I save a file. When I save a file it seems like something changes in core data because my original fetch request no longer fetches anything. This is the fetch request that works before saving but returns an empty array after saving.
NSEntityDescription *outputCellEntityDescription = [NSEntityDescription entityForName:@"OutputCell"
inManagedObjectContext:[[self document] managedObjectContext]];
NSFetchRequest *outputCellRequest = [[[NSFetchRequest alloc] init] autorelease];
[outputCellRequest setEntity:outputCellEntityDescription];
NSPredicate *outputCellPredicate = [NSPredicate predicateWithFormat:@"(cellTitle = %@)", outputCellTitle];
[outputCellRequest setPredicate:outputCellPredicate];
NSError *outputCellError = nil;
NSArray *outputCellArray = [[[self document] managedObjectContext] executeFetchRequest:outputCellRequest
error:&outputCellError];
I have checked with [[[self document] managedObjectContext] registeredObjects] to see that the object still exists after the save and nothing seems to have changed and the object still exists. It is probably something fairly basic but does anyone know what I might be doing wrong? If not can anyone give me any pointers to what might be different in the Core Data model after a save so I might have some clues why the fetch request stops working after saving?
© Stack Overflow or respective owner