title: Core Data - sharing NSManagedObjects among multiple threads
body: <p>I suffered all the consequences of using a single MOC in multiple threads - my app crashes at random points because the MOC is created in the main thread and I also use it to fill the DB in another thread.
  Though the code is synchronized (@synchronize) using a global singleton the app crashes.
  I read that using a separate MOC for each thread will make things ok but I also read that it is considered also a bad approach to share NSManagedObjects across threads.</p>
  
  <p>My use case is the following:
  1)I load and parse XML from a server and during the parsing I insert each new NSManagedObject in the database. This all happens in a separate thread.
  2)From the main thread the user interacts with the UI which reads data from the database.</p>
  
  <p>In both threads I use NSManagedObjects. How would you suggest me to fix this? I failed multiple times already.</p>
  
  <p>Most often the app creashed with error suggesting that I am modifying a collection while enumerating it which is not true as the code is synchronized and while I am iterating it no modifying happens and vice versa - while I modify it I don't iterate and I save once I am done.</p>