我正在尝试将闪存卡存储模块存储到核心数据中,将各个存储卡存储到核心数据中。牌组是具有名称和自定义类别卡的数组的自定义类别,卡仅具有术语和定义。但我不断出错:
'NSInvalidArgumentException', reason: 'An NSManagedObject of class 'flashcard_.Cards' must have a valid NSEntityDescription.'
当我按下addCardPressed时出错,我不知道我要去哪里。
2019-01-05 18:00:55.196270-0600 flashcard![35177:1718243] [error] error: Failed to load model named flashPrototype
CoreData: error: Failed to load model named flashPrototype
2019-01-05 18:00:55.197121-0600 flashcard![35177:1718243] [error] error: No NSEntityDescriptions in any model claim the NSManagedObject subclass 'flashcard_.Cards' so +entity is confused. Have you loaded your NSManagedObjectModel yet ?
CoreData: error: No NSEntityDescriptions in any model claim the NSManagedObject subclass 'flashcard_.Cards' so +entity is confused. Have you loaded your NSManagedObjectModel yet ?
2019-01-05 18:00:55.197499-0600 flashcard![35177:1718243] [error] error: +[flashcard_.Cards entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass
CoreData: error: +[flashcard_.Cards entity] Failed to find a unique match for an NSEntityDescription to a managed object subclass
2019-01-05 18:00:55.341425-0600 flashcard![35177:1718243] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'An NSManagedObject of class 'flashcard_.Cards' must have a valid NSEntityDescription.'
@IBAction函数addCardPressed(_发件人:任意){
if(termInput.text != "type term here..." && definitionInput.text != "type definition here..." && termInput.text != "" && definitionInput.text != ""){
let cardToAdd = Cards(context: context)
cardToAdd.term = termInput.text
cardToAdd.definition = definitionInput.text
cardArray.append(cardToAdd)
}
}
@IBAction func studyPressed(_ sender: Any) {
if(deckNameInput.text != "" && deckNameInput.text != "ex: physchology 101"){
let deck = Decks(context: context)
deck.cards = cardArray
deck.name = deckNameInput.text
ad.saveContext()
}