【发布时间】:2013-04-06 17:46:10
【问题描述】:
我需要为 Core Data 中的每个排列对象更新一个值,我目前正在使用循环。但我想知道以下代码是否是线程安全的,以及为什么。
ManagedObjectContext 不是线程安全的,解释here
[myArrayController.arrangedObjects enumerateObjectsWithOptions:NSEnumerationConcurrent
usingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
// do some work
[obj setValue:@"some value" forKey:@"aKey"];
}]
【问题讨论】:
标签: core-data thread-safety enumeration nsmanagedobjectcontext nsarraycontroller