How does a custom accessor method implementation in Core Data look like?
Posted
by dontWatchMyProfile
on Stack Overflow
See other posts from Stack Overflow
or by dontWatchMyProfile
Published on 2010-06-11T12:20:55Z
Indexed on
2010/06/11
12:22 UTC
Read the original article
Hit count: 263
The documentation is pretty confusing on this one:
The implementation of accessor methods you write for subclasses of NSManagedObject is typically different from those you write for other classes.
If you do not provide custom instance variables, you retrieve property values from and save values into the internal store using primitive accessor methods. You must ensure that you invoke the relevant access and change notification methods (willAccessValueForKey:, didAccessValueForKey:, willChangeValueForKey:, didChangeValueForKey:, willChangeValueForKey:withSetMutation:usingObjects:, and didChangeValueForKey:withSetMutation:usingObjects:). NSManagedObject disables automatic key-value observing (KVO, see Key-Value Observing Programming Guide) change notifications, and the primitive accessor methods do not invoke the access and change notification methods.
In accessor methods for properties that are not defined in the entity model, you can either enable automatic change notifications or invoke the appropriate change notification methods.
Are there any examples that show how these look like?
© Stack Overflow or respective owner