这是发生错误时的代码部分:
class func randomWord() -> TBWord {
let randomIndex = Int(arc4random_uniform(UInt32(TBAppSettings.wordsForCurrentGame.count)))
let word = TBAppSettings.wordsForCurrentGame[randomIndex]
TBAppSettings.wordsForCurrentGame.removeAtIndex(randomIndex)
MagicalRecord.saveWithBlock { context in
let word = TBWord.findWordWithIdentifier(word.identifier, inContext: context) //here error happens
word?.used = true
}
return word
}
我该如何解决这个问题?我知道关于这个问题的其他问题,但它们对我来说还不够。
最佳答案
(除此之外,MagicalRecord 是对如何正确使用 Core Data 的一个很大的误解......)
您是否尝试过使用 -com.apple.CoreData.ConcurrencyDebug 1
作为启动参数来运行代码?这听起来像是线程问题。
关于ios - "CoreData: error: NULL _cd_rawData but the object is not being turned into a fault",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34550694/