Usin开发者_运维百科g CoreData (on an iPhone app) I generated my entity classes from the model and I added some more methods to some ones. It appears that sometimes I get an exception for calling one of those methods. The exception is not random but concerns only some ManagedObject subclass (the others seem to respond correctly). Here is an example of what i get:
-[NSManagedObject printTime]: unrecognized selector sent to instance 0x5b50af0
2010-07-15 10:29:55.216 LP[6686:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSManagedObject printTime]: unrecognized selector sent to instance 0x5b50af0'
The NSManagedObject is an object I get from a fetch (casted to the correct subclass), and the methods I am talking about are printing methods. (I tried to retrieve those not as faults either) Am I missing something?
Did you set the correct class for the entity in the managed object model?
精彩评论