Simultaneidad de CoreData: ¿necesito una NSOperationQueue separada?

I have a CoreData app in which I have two NSNanagedContext:s for concurrency. One for the main thread and one for my background thread.

In one of my view controllers I also have a separate NSOperationQueue, which I use like this:

[self.queue addOperationWithBlock:^{
    [self processDataFromDictionary:jsonObject];
    [...]

I've noticed that my NSNanagedContext also have a perform block method. If I instead wrote:

 [self.backgroundContext performBlock:^{
    [self processDataFromDictionary:jsonObject];

Would that also be executed asynchronously?

preguntado el 05 de mayo de 13 a las 21:05

1 Respuestas

If your managed object context is created using appropriate concurrency type, calling performBlock from any other queue will cause the block to be executed asynchronously on the context's own queue.

Respondido 13 Oct 13, 19:10

Ok, thanks! So the other queue is needed to make it asynchronously then? - Anders

Algo como eso. Aquí hay un tutorial decente on the patterns you can adopt using the concurrency APIs added in iOS 5. - rickster

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.