performBlockAndWait和主要上下文:规范解决方案

时间:2016-02-22 21:03:23

标签: ios objective-c core-data concurrency

我有一个我经常使用的Core Data应用程序:

[[MyCoreDataStore defaultStore].mainQueueContext performBlockAndWait:^{
     // perform some operations
     [MyCoreDataStore saveMainQueueContext];
}];

在外部代码审核期间,有人指出主要上下文中的performBlockAndWait:是错误的。

我正在阅读StackOverflow的一些问题但是找不到规范的方法来处理并发而不是阻止主要的上下文

Core Data main context concurrency

NSManagedObjectContext performBlockAndWait: doesn't execute on background thread?

performBlockAndWait On Child Context with Private Queue Deadlocks Parent on iOS 7

Multiple contexts in the main thread: why and when use them?

那么处理并发并保持主要上下文畅通无阻的规范方法是什么?

0 个答案:

没有答案