我需要更新 Core Data 中每个排列对象的值,我目前正在使用循环。但我想知道以下代码是否是线程安全的,以及为什么.
ManagedObjectContext 不是线程安全的,这里解释
[myArrayController.arrangedObjects enumerateObjectsWithOptions:NSEnumerationConcurrent
usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
// do some work
[obj setValue:@"some value" forKey:@"aKey"];
}]