Core Data executeFetchRequest throws NSGenericException (Collection was mutated while being enumerated)

后端 未结 4 1535
忘掉有多难
忘掉有多难 2021-02-09 13:04

I\'m developing a iPhone app with Core Data. All user data should be synchronized with our servers. For this purpose I created a subclass of NSOperation witch loads new data fro

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-09 13:14

    Off the top of my head: Is the "synchronization" thread adding new objects to the Department collection while iterating on it on the main thread?

    Usually, this type of exception occurs when you're modifying a collection at the same time you're enumerating it. In a multi-threaded scenario, it might also mean your collection is enumerated and updated concurrently without proper thread synchronization.

提交回复
热议问题