Anna
Anna

Reputation: 955

How to implement core data in multi-threading environment

I am trying to implement core data entities in a multi-threaded environment. I understand iOS guidelines, for having private managed object contexts per thread. I have read about how UIManagedDocument integrates well with core data objects. Can anyone suggest, if using UIManagedocument is the recommended approach? Since, this was released in iOS-5, will my app work on devices that have i0s 4.3.3 or earlier? Also, can someone refer me to some tutorials/examples that will guide me on this topic?

Upvotes: 2

Views: 302

Answers (1)

Jody Hagins
Jody Hagins

Reputation: 28349

Core Data is simple. Until you use multiple MOCs and threads. Then, you have to really pay attention to a lot of details, pretty quickly.

No, the Core Data stuff introduced in iOS 5 is not backward compatible to previous versions.

Here is the guide for concurrency in general: http://developer.apple.com/library/ios/#documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008091

and concurrency with core data in specific: http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CoreData/Articles/cdConcurrency.html#//apple_ref/doc/uid/TP40003385-SW1

If you write multithreaded programs using core data, and have not read those documents (at minimum), you are just asking for trouble... and you deserve all you get.

Upvotes: 2

Related Questions