swift - 核心数据:无法识别的选择器发送到实例错误
问题描述
我正在尝试将自定义类保存到核心数据中,但出现此错误
2019-01-07 16:58:25.147183-0600 flashcard![21075:2906968] [error] error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x2808f4780> , -[flashcard_.Card encodeWithCoder:]: unrecognized selector sent to instance 0x2837aefd0 with userInfo of (null)
CoreData: error: SQLCore dispatchRequest: exception handling request: <NSSQLSaveChangesRequestContext: 0x2808f4780> , -[flashcard_.Card encodeWithCoder:]: unrecognized selector sent to instance 0x2837aefd0 with userInfo of (null)
2019-01-07 16:58:25.149540-0600 flashcard![21075:2906968] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[flashcard_.Card encodeWithCoder:]: unrecognized selector sent to instance 0x2837aefd0'
当我尝试保存上下文时。我不知道我在这里做错了什么。
@IBAction func studyPressed(_ sender: Any) {
var deck = Decks(context: context)
deck.name = deckNameInput.text!
deck.cards = cardArray
if(deckNameInput.text != "" && deckNameInput.text != "ex: physchology 101"){
do {
try ad.saveContext()
} catch {
}
}
}
解决方案
推荐阅读
- java - 当我编译时,它说在 deque java 中找不到符号,我也不知道为什么剂量 pushleft 包含这一行 left = (left+1) % queue.length;
- python - 检索未知文件夹的文件夹名称
- android - 不推荐使用 getAdapterPosition()
- botframework - 无法访问应用程序。请在 v4 VA 中的自适应卡上重试
- kotlin - 如何在 Gradle 插件中表达项目依赖关系?
- java - 当 obj 可以为空时,java 中的 synchronized(obj) 块
- python - Python UnicodeDecodeError:'utf-8'编解码器无法解码位置 670 中的字节 0xc4:无效的继续字节
- python - MemoryError:无法为形状为 (5844379795,) 且数据类型为 int64 的数组分配 43.5 GiB
- javascript - git push heroku master 给我一个错误
- reactjs - 推断 rootState 类型时出错 | TS2339