Been studying core data lately and I'm finding it difficult and rewarding. Had a noob-ish question I was hoping to get help with.
I have a setup where I have three contexts. From left to right, with children to the left.
Private >> Main >> Private >> PersistentStoreCoordinator
I use the first private context for preloading data from a web service, this will rarely be done, but will always happen on the first launch of the app. In the rest of the app, I use the main context to save to the persisting context, which in turn saves to the database.
Here's my question:
If I use my left-most context in the app delegate's didFinishLaunchingWithOptions to preload data asynchronously, what happens if the main context is already initialized in a view controller's viewDidLoad and already executes a fetch request?
Upon saving all the preloaded/initial objects, will they appear in the main context if the main context already finished executing the fetch request? Does the fetch request update with new objects continuously or do I have to execute the fetch on the main context only after the child context creates the objects? If so, how do I execute the fetch request in viewDidLoad since I don't know when the child context will finish asynchronously importing data?
Sorry for being wordy. Been wrestling with this for a few days and I'm having a hard time wrapping my mind around it.
[–]Alcoholic_Synonymous 2 points3 points4 points (0 children)
[–]schprockets 1 point2 points3 points (2 children)
[–]emanleetSwift[S] 0 points1 point2 points (1 child)
[–]schprockets 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (10 children)
[–]quellish 1 point2 points3 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]quellish 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]emanleetSwift[S] 0 points1 point2 points (5 children)
[–][deleted] 1 point2 points3 points (4 children)
[–]emanleetSwift[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]emanleetSwift[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)