Re: Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?
Re: Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?
- Subject: Re: Core Data mergeChangesFromContextDidSaveNotification: does not *completely* update the context ?
- From: Aurélien Hugelé <email@hidden>
- Date: Mon, 20 Dec 2010 10:36:08 +0100
BTW, the main thread sent notification (when main thread moc is saved) does not contain the NSRefreshedObjects key.
This would probably be a solution to my problem, but mergeChangesFromContextDidSaveNotification: either does not refresh objects (strange) or their is something wrong since objects are definitely refreshed, so why does NSRefreshedObjects key is not in the didSaveNotification ?
Aurélien,
Objective Decision Team
Le 20 déc. 2010 à 06:49, Aurélien Hugelé a écrit :
> 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
_______________________________________________
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