According to the WWDC 2012 video, "Core Data Best Practices", dispatch_sync should be used to run some kind of callback in performBlock of context, which is created as a type of NSPrivateQueueConcurrencyType.
Why is that?
Can I use dispatch_async(dispatch_get_main_queue(), 0)... to call some UI-related callbacks in private queue's context's performBlock?
No. NSPrivateQueueConcurrencyType manages it's own internal queue, and does not enjoy you trying to leave one of it's threads to do what you want to do (in fact, I believe it throws exceptions when this type of behavior occurs). There's a few ways of handling this, of course signalling semaphores being the more acceptable design pattern to get the truly "async feel", but as you note, dispatch_sync is usually the way to go.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With