If I create a NSManagedObjectContext
on the main thread with NSMainQueueConcurrencyType
must I use performBlock()
method for all the save
and performFetch
methods. IE is it possible to do the following:
do {
managedObjectContext.save()
} catch let error as NSError {
print(error)
}
or should I always do this:
managedObjectContext.performBlock({
do {
managedObjectContext.save()
} catch let error as NSError {
print(error)
}
})
If I understand the documentation correctly I always have to use performBlock()
or performBlockAndWait()
but in the template code from XCode 7 they are not using blocks. Any help is appreciated!
If you are already on the main thread and have a NSMainQueueConcurrencyType
context, you do not need to use performBlock
.