Core Data Confusion

Christiaan Hofman cmhofman at gmail.com
Mon Feb 5 09:33:17 PST 2007


On 5 Feb 2007, at 6:19 PM, Shawn Erickson wrote:

> On 2/5/07, Marcus S. Zarra <mzarra at mac.com> wrote:
>> The KVO methods do not fire faults in Core Data.

So why does the documentation on didAccessValueForKey : say / 
explicitly/:

Together with willAccessValueForKey:, this method is used to fire  
faults, ...

(see the link in the earlier mail from Shawn Erickson).

>> Core Data retrieves
>> all of the values for a managed object when that object is accessed.
>> It specifically does not do any lazy initialization of attributes.
>> However, it does do lazy initialization of relationships.
>
> I should also note that your are making assumption about how Core Data
> will operate... it could change its faulting behavior in the future
> (it could lazily load some subset of attributes). Using the correct
> will/did Access/Change methods when dealing with primitive values will
> protect you from changes in the implementation.
>
> The API and documentation do not preclude that Apple could extend Core
> Data in such ways... (in fact the documentation recommendations and
> API actually support that type of enhancement)
>
> -Shawn

Exactly my point: perhaps it does nothing in some specific cases, but  
you cannot rely on that as long the documentation says otherwise. And  
as I noted: subclassers could also change that behavior.

Christiaan



More information about the MacOSX-dev mailing list