Hi,
I am wrecking my brain on a problem that boils down to the behavior of the isUpdated flag on an NSManagedObject. What I read in the documentation is: "The receiver has unsaved changes if it has been updated since its managed object context was last saved." My understanding of this is that as long as I don't execute save on NSManagedObjectContext, the modified objects have the isUpdated flag set.
This is not what I see in my code though (see below). The isUpdated flag still returns false after the object had been modified. I am clearly missing something, but what could it be?
While writing this up, I think the light went on inside my head... The change is probably already saved behind the scene by CoreData. If that is true, I wonder how one could ever get into a situation where the isUpdated flag is TRUE, and a NSManagedObjectContext:save is required.
I'll dig a little deeper, but any insight provided in the mean time is highly appreciated.
Kine Regards,
Erwin
Xcode 3.2.1 iPhone SDK
Person *person = [NSEntityDescription insertNewObjectForEntityForName:@"Person" inManagedObjectContext:[self managedObjectContext]]; NSLog(@"person = %@\n isUpdated = %d", [person description], [person isUpdated]); [person setFirstName:@"Johnny"]; NSLog(@"person = %@\n isUpdated = %d", [person description], [person isUpdated]);
addressBookRecordID = 0; ... firstName = nil; ... }) isUpdated = 0
addressBookRecordID = 0; ... firstName = Johnny; ... }) isUpdated = 0 |