I received a "Message" is not a subclass of NSManagedObject error after trying to click on a button in my app. The app compiles just fine and I can use every other part of my app. The interesting thing is that it runs just fine in iOS7 but crashes in iOS6. I have read to prefix my entity but since it is called in about 50 classes I am checking to see if there is a different solution. I am also curious why it works in iOS7 but not iOS6. Also If I delete the MessageUI.framework it works on iOS6 and iOS7.
I discovered that if I use the default on the CONFIGURATIONS/Default (Class is the same as the Entity name: my image example of "WebResource" that I would get an exception
reason: '"WebResource" is not a subclass of NSManagedObject.'
at statement:
WebResource *entry = [NSEntityDescription insertNewObjectForEntityForName:@"WebResource" inManagedObjectContext:mymanagedObjectContext];
but all works fine if i change the Class to "NSManagedObject". I do not know why the default is not "NSManagedObject" :(
It seems some names just don't work for entities: Message
, WebResource
, BluetoothDevice
(as of iOS 11).
Renaming the entity and associated class solved it for me.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.