Showing posts with label nsmanagedobjectcontext. Show all posts
Showing posts with label nsmanagedobjectcontext. Show all posts

Friday, February 24, 2012

CoreData relationships are nil after mergeChangesFromContextDidSaveNotification


Having some truly strange behavior with Core Data on iOS. I have a NSManagedObjectContext for my main thread used to read data from a SQLLite persistent store and display it to the user. I also have background processes managed by an NSOperationQueue. These background processes create an NSMangedObjectContext, fetch data from remote servers, and persist that data to the local Core Data store. I have registered for NSManagedObjectContextDidSaveNotification and when I receive those notifications call mergeChangesFromContextDidSaveNotification on the main threads NSManagedObjectContext (passing the notification object as an argument).