Re: refreshing core data controller
Re: refreshing core data controller
- Subject: Re: refreshing core data controller
- From: Pavel Hlavnicka <email@hidden>
- Date: Fri, 01 Jun 2007 10:28:21 +0200
George (anonymous) pointed me to this resource
<http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/Articles/cdBindings.html#//apple_ref/doc/uid/TP40004194-DontLinkElementID_72>
and it was exactly what I needed.
Thanks a lot and hope it will help someone else too.
Pavel
Pavel Hlavnicka wrote:
Dear all,
I have an application using Core Data. In my nib file I have a couple of
NSArrayControllers bound to NSManagedObject context and core data
entities with no predicates.
In a separate thread I'm changing the data (shared instance of
coordinator, separate instance of managed context). Then I need to
refresh data in the main thread (UI).
I use -[NSManagedObjectContext reset] and various combinations of
-[NSArrayController repareContent] and -[NSArrayController fetch:]
My UI is refreshed fine but I'm having problems to access values via
-[NSArrayController arrangedObject] right after I call reset on the
managed context - arrangedObjects returns just an empty array.
Is there something I'm missing? Is there some better way how to do it?
Sample code follows:
[myManagedContext reset];
[myController prepareData];
[myController fetch:self];
NSArray * arr = [myController arrangedObjects]; //ALWAYS EMPTY
.... but UI a bit later is refreshed correctly.
Thank you
Pavel
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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)
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