Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?
Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?
- Subject: Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?
- From: Aurélien Hugelé <email@hidden>
- Date: Mon, 20 Dec 2010 06:49:34 +0100
Hi!
I think mergeChangesFromContextDidSaveNotification: does not work as most people expect:
I have a mainthread and a subthread. My subthread updates a managed object (change one of the property value) and save.
In the mainthread, I use [mainThreadContext mergeChangesFromContextDidSaveNotification:subThreadNotification]; and it merges the main thread context as expected (binded UI is updated)
What is not expected is :
1/ asking the main thread for its updatedObjects (just after the mergeChangesFromContext... but before the save:) does not show the changes made in the subthread! So updated objects in subthread are not seen as updated in the main thread after the mergeChangesFromContext call!
2/ Saving the main thread generates a did save notification, that does not contain changes made in the subthread (and merged) !
The subthread is temporary (does it job in an NSOperation that terminates quickly), its context is also temporary.
In the mainthread, *many* controllers are observers of the did save notification of the main thread context. How am I supposed to make them listen to changes made in a temporary, dumb, subthreaded managed context without using mergeChangesFromContext... call ???
I'm pertty sure, most developers expect the mergeChangesFromContextDidSaveNotification: API to really merge the data in the main thread context and set the merged updated objects as *really* updated, as if the change really occured in the main thread!
Aurélien,
Objective Decision Team
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden