refreshing core data controller
refreshing core data controller
- Subject: refreshing core data controller
- From: Pavel Hlavnicka <email@hidden>
- Date: Wed, 30 May 2007 16:43:42 +0200
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