On 2010 Nov 16, Adam Swift wrote: > What you seem to be describing shouldn't be possible (unless you've added > property accessors to NSManagedObject via a category)
I definitely have not done that. I subclass NSManagedObject. Let's step back a little here: > You should be able to use the standard KVC accessors during migration, > NSManagedObjects will respond to the foo/setFoo: laccessors for properties > defined in your managed object model. Well, -foo and -setFoo: won't even compile unless I change the type of the sourceInstance: parameter of the method to be a MyManagedObject* like this: - (BOOL)createDestinationInstancesForSourceInstance:(MyManagedObject*)foo entityMapping:(NSEntityMapping*)inMapping manager:(NSMigrationManager*)inManager error:(NSError**)error_p or else do some equivalent typecasting in the implementation. > - the accessors defined on your subclass are not going to be called during > migration because the instances being migrated are not instances of your > class. Makes sense, but I distinctly remember debugging this and seeing in the call stack that KVO was calling my custom accessors. I'll have a closer look the next time that I run into this problem. Making a demo project of a Core Data migration is quite tedious. By the way, my custom accessors are also called if I used -valueForKey: and -setValue:forKey:. This is per documentation [1]: "The access pattern key-value coding uses for managed objects is largely the same as that used for subclasses of NSObject—seevalueForKey:" and drilling down, [2]: Default Search Pattern for valueForKey: When the default implementation of valueForKey: is invoked on a receiver, the following search pattern is used: • Searches the class of the receiver for an accessor method whose name matches the pattern -get<Key>, -<key>, or -is<Key>, in that order. [1] http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CoreData/Articles/cdAccessorMethods.html#//apple_ref/doc/uid/TP40002154-SW9 [2] http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/SearchImplementation.html#//apple_ref/doc/uid/20000955 _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com