insertNewObjectForEntityForName: inManagedObjectContext: returning NSNumber bug?

Posted by beinstein on Stack Overflow See other posts from Stack Overflow or by beinstein
Published on 2010-04-29T18:19:21Z Indexed on 2010/04/29 21:17 UTC
Read the original article Hit count: 332

I'm relatively well versed in CoreData and have been using it for several years with little or no difficulty. All of a sudden I'm now dumbfounded by an error. For the life of me, I can't figure out why

insertNewObjectForEntityForName:inManagedObjectContext:

is all of a sudden returning some sort of strange instance of NSNumber. GDB says the returned object is of the correct custom subclass of NSManagedObject, but when I go to print a description of the NSManagedObject itself, I get the following error:

*** -[NSCFNumber objectID]: unrecognized selector sent to instance 0x3f26f50

What's even stranger, is that I'm able to set some relationships and attributes using setValue:forKey: and all is good. But when I try to set once specific relationship, I get this error:

*** -[NSCFNumber entity]: unrecognized selector sent to instance 0x3f26f50

Has anyone ever encountered anything like this before? I've tried clean all targets, restarting everything, even changing the model to the relationship in question is a to-one instead of a to-many. Nothing makes any difference.

© Stack Overflow or respective owner

Related posts about core-data

Related posts about iphone