【问题标题】:"CoreData: error: NULL _cd_rawData but the object is not being turned into a fault"“CoreData:错误:NULL _cd_rawData 但对象没有变成故障”
【发布时间】:2016-01-03 03:03:34
【问题描述】:

这是发生错误时的代码部分:

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
}

我该如何解决这个问题?我知道有关此问题的其他问题,但对我来说还不够。

【问题讨论】:

    标签: ios swift core-data


    【解决方案1】:

    (除了MagicalRecord对如何正确使用Core Data是一个很大的误解......)

    您是否尝试过使用-com.apple.CoreData.ConcurrencyDebug 1 作为启动参数来运行您的代码?这闻起来像是线程问题。

    【讨论】:

      猜你喜欢
      • 2012-03-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-11-10
      • 1970-01-01
      • 2011-08-01
      • 2012-08-07
      相关资源
      最近更新 更多