• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
What is the behavior of 'isUpdated' on an NSManagedObject?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

What is the behavior of 'isUpdated' on an NSManagedObject?


  • Subject: What is the behavior of 'isUpdated' on an NSManagedObject?
  • From: Erwin Hogeweg <email@hidden>
  • Date: Sat, 07 Nov 2009 12:10:59 -0500

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]);


11/7/09 11:30:48 AM otest[3643] person = <Person: 0x2e08590> (entity: Person; id: 0x2e00b00 <x-coredata:///Person/t8C2B19BF-35D0-4BF1-AF41-19898101D6024> ; data: {
    addressBookRecordID = 0;
...
    firstName = nil;
...
})
 isUpdated = 0

11/7/09 11:30:48 AM otest[3643] person = <Person: 0x2e08590> (entity: Person; id: 0x2e00b00 <x-coredata:///Person/t8C2B19BF-35D0-4BF1-AF41-19898101D6024> ; data: {
    addressBookRecordID = 0;
...
    firstName = Johnny;
...
})
 isUpdated = 0
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: What is the behavior of 'isUpdated' on an NSManagedObject?
      • From: Keary Suska <email@hidden>
  • Prev by Date: Re: Giving colors to entities in a data model
  • Next by Date: Re: What is the behavior of 'isUpdated' on an NSManagedObject?
  • Previous by thread: Re: Icon Composer - how to set a custom colour?
  • Next by thread: Re: What is the behavior of 'isUpdated' on an NSManagedObject?
  • Index(es):
    • Date
    • Thread