I have a Mac (not document) app, that uses CoreData.
When launching the app, it reads the data stored on the filesystem.
I have to setup some things in -(void)applicationDidFinishLaunching based on the information stored using CoreData.
So it would be nice to know when my app read everything from disk.
If I do my setup in -(void)applicationDidFinishLaunching i doesn’t work. If I do it a few seconds later it works!
Thx!
If you are using object controllers that automatically prepare their own content, you can observe
arrangedObjectsto find out when they have fetched their content. This does not guarantee that the actual objects are not faults. In fact, that’s one of the main strengths of Core Data: objects are lazily loaded from disk.If you for some reason want to make sure that most disk activity has taken place in
applicationDidFinishLaunching, you can perform a custom fetch that specifically does not return objects as faults. Look up “prefetching” in the Core Data documentation. However, there is no guarantee that Core Data won’t fault these objects at a later time due to memory constraints, thereby incurring another disk read when those objects are loaded again.You can of course also use the
NSBinaryStoreType, in which case the entire store is loaded into memory synchronously when it is added to the persistent store coordinator.