• 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
Another Core Data Ivar Setter and Undo Issue
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Another Core Data Ivar Setter and Undo Issue


  • Subject: Another Core Data Ivar Setter and Undo Issue
  • From: "Ian G. Gillespie" <email@hidden>
  • Date: Tue, 26 Jun 2007 17:29:12 -0400

I've searched the archives and couldn't find and answer to my question, so here goes...

I have Core Data app where one entity say, "Department", wants to know when there is a change in one of its "Employee" entities (typical one-to-many relationship example). In the past I registered Department as an observer for changes in its Employees for the key paths of interest. This worked fine accept that it led to some performance issues when a Department was registering for changes in say 5000-10,000 Employees. To address this I wanted to use my know observing-notification system using NSNotificationCenter. I started implementing custom accessors in my Employee managed object sub-class so that I could post notifications (as seen below).

The problem is when I undo a change made on an Employee's property the setMyValue: method is not called again. It is only called when the user actually changes a value via bindings on the UI. I was hoping that when Core Data invokes undo that it would call the appropriate setter value for the property that changed. Is this the expected behavior of Core Data?

-(void)setMyValue:(NSNumber *)sumValue {

	[self willChangeValueForKey:@"myValue"];
	[self setPrimitiveValue:sumValue forKey:@"myValue"];
	[self didChangeValueForKey:@"myValue"];

//post the notification
[[NSNotificationCenter defaultCenter] postNotificationName:@"myValueDidChange" object:self userInfo:nil];


}




_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Another Core Data Ivar Setter and Undo Issue
      • From: Felix Franz <email@hidden>
    • Re: Another Core Data Ivar Setter and Undo Issue
      • From: Chris Hanson <email@hidden>
  • Prev by Date: Re: Play a song with QTMovie
  • Next by Date: Re: Play a song with QTMovie
  • Previous by thread: Re: Core Data / Bindings question
  • Next by thread: Re: Another Core Data Ivar Setter and Undo Issue
  • Index(es):
    • Date
    • Thread