Re: Reliable way to find out if CoreData finished loading
Re: Reliable way to find out if CoreData finished loading
- Subject: Re: Reliable way to find out if CoreData finished loading
- From: Mantas Masalskis <email@hidden>
- Date: Sat, 19 Sep 2009 13:26:37 +0300
Hi,
I have 3 objects in Interface Builder: NSArrayController,
NSManagedObjectContext and object that is NSApp's delegate.
NSManagedObjectContext is using XML store as backend
NSArrayController is binded to NSManagedObjectContext
When application starts, on applicationFinishedLauncing
NSArrayController is empty. [nsarraycontroller fetch:] didnt help.
However, after a while, it has all data just fine....
What is the appropriate way to do smth once Managed Object Context
is loaded?
"smth" is to get count of certain objects on application start
Mantas Masalskis
On Sep 18, 2009, at 7:08 PM, I. Savant wrote:
On Sep 17, 2009, at 6:46 PM, Mantas Masalskis wrote:
I'm loading Core Data object via Managed Object Context in IB. It
looks like it hasn't finished loading when
applicationDidFinishLoading is fired.
Perhaps thinking about this a different way would clarify things.
You don't "load a context". You create a context and use it to fetch
objects from the store (or merely to create objects if you're using
an in-memory store).
So, if you have some controllers that aren't ready yet, you can
simply instruct them to -fetch: ... this will force them to fetch
immediately, rather than waiting for a future cycle of the run loop.
What is the appropriate way to do smth once Managed Object Context
is loaded?
What's a "smth"?
--
I.S.
_______________________________________________
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