In the documentation: NSManagedObjectContext Class Reference it states:
Setter methods on queue-based managed object contexts are thread-safe. You can invoke these methods directly on any thread.
Can someone give a code example of what exactly this means. Does it actually mean to read "Setter methods on queue-based managed OBJECTS are thread-safe"
Also, if I have a managed object stored as an iVar (not best practice), can I called it's managedObjectContext method and its and then call performBlock() on this safely from within any thread?
No, it means exactly what it says. You can call setter methods on a NSManagedObjectContext from any thread. eg: -[setParentContext:], -[setPersistentStoreCoordinator:].
You can call -[performBlock:]and -[performBlockAndWait:] from any thread as it will execute the passed block on the context's queue.
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