Re: CoreData - NSManagedObjectContext notifications - Save vs DidChange ?
Re: CoreData - NSManagedObjectContext notifications - Save vs DidChange ?
- Subject: Re: CoreData - NSManagedObjectContext notifications - Save vs DidChange ?
- From: Simon Liu <email@hidden>
- Date: Thu, 6 Oct 2005 01:17:04 +0100
Thanks, but nope, my issue is not related to inserts. I have a table
column with an image cell, bound to
ArrayController.arrangedObjects.imageData. Now, normally in a single
threaded app, I just KVC set the 'imageData' attribute of the relevant
object, and the table column's view is updated automatically with a
thumbnail image.
However, since I have a background thread creating thumbnails, that
thread must use its own private managed object context. Updating the
attribute of the object in my private context won't cause the table
view to be updated. The ArrayController is bound to my Application
delegate's managedObjectContext, so I need to make sure the changes
made in the private context are reflected in this shared context.
What I notice is that with the Change notification, the table column's
view does not change each time my handler is invoked. However, using
the same handler with a Save Notification does result in the table
column's view updating.
So I think invoking -save: on the private context, which triggers the
Save notification, does something else (apart from saving to a
persistent store)... and I'd like to find out what that is, and do it
manually so that I can use the Change notifications.
Hopefully the above makes the issue a little clearer!
On 10/5/05, Bill Cheeseman <email@hidden> wrote:
> on 2005-10-05 4:38 PM, Simon Liu at email@hidden wrote:
>
> > Except that if I use the same handler for
> > NSManagedObjectContextObjectsDidChangeNotification, I notice that the
> > tableview does not update. It seems as though the array controller can't
> > "see" the refreshing. Is there any way to make this happen, as I thought it
> > would be possible to do this, without having to invoke -save: which is more
> > expensive as it writes to the store.
>
> I haven't studied your question closely, so this may not be responsive. I
> just want to say that I have noticed that
> NSManagedObjectContextObjectsDidChangeNotification doesn't do anything until
> the next iteration of the run loop. To update a table, I found that I had to
> move my code from the notification method to -awakeFromInsert, which is
> called in the same cycle as the insertion. It doesn't sound like your issue
> is an insertion issue, so this may not be a solution for you, but it
> suggests you might want to look for something that gets invoked during the
> same cycle.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden