每次尝试学习闪存卡时,我都试图更新其分数,但是分数没有保存。我在做什么错了?
do {
fetchedCards = try context.fetch(Cards.fetchRequest())
for cards in fetchedCards {
if(termLabel.text == cards.term){
cards.score = score
ad.saveContext()
continue
}
}
} catch {
}
let ad = UIApplication.shared.delegate as! AppDelegate
let context = ad.persistentContainer.viewContext