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:44:15Z Indexed on 2010/04/29 18:47 UTC
Read the original article Hit count: 325

I'm relatively well versed in CoreData and have been using it for several years with little or no difficulty. 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 one specific relationship, I get this error:

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

I've tried everything from clean all targets, to restarting both mac and iPhone, even editing the model so that the relationship in question is to-one instead of to-many. No matter what I do, the same problem appears. Has anyone ever seen anything like this before?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk