2

Using 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?

rano
  • 5,616
  • 4
  • 40
  • 66
  • Did you set the correct class for the entity in the managed object model? – Martin Brugger Jul 15 '10 at 09:25
  • Now that you mention it I saw that in the model some entities have the right class set, other no. I'm wondering how this could have happened. Anyways thanks a lot, you solved my question (how can i tag your comment as the correct answer?) – rano Jul 15 '10 at 11:22

1 Answers1

10

Did you set the correct class for the entity in the managed object model?

Martin Brugger
  • 3,168
  • 26
  • 20
  • 2
    Even as a senior iOS developer I constantly forget this step. Thanks heaps Martin! :D – Tim Nov 24 '12 at 15:08