Core Data error: -[myclass encodeWithCoder:]: unrecognized selector sent to instance

混江龙づ霸主 提交于 2019-12-06 15:41:24

How did you define the myClass ivar in your entity? You can use a Transformable attribute to hold a non standard type. The idea is that Core Data uses behind the scenes an instance of NSValueTransformer to convert the attribute to and from an instance of NSData.

Core Data then stores the data instance to the persistent store.

By default is used the NSKeyedUnarchiverFromDataTransformerName, this means your custom class must implement the NSCoding protocol (with support for keyed-archiving)

Check "Non-Standard Persistent Attributes" in the Core Data Programming Guide for more details and description of another way to accomplish the same.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!