Pattern for iPhone background loading during init?
Posted
by Rob S.
on Stack Overflow
See other posts from Stack Overflow
or by Rob S.
Published on 2010-04-19T18:54:16Z
Indexed on
2010/04/19
19:13 UTC
Read the original article
Hit count: 216
Hi everyone,
I'm currently kicking off a background thread to do some REST queries in my app delegate's didFinishLaunchingWithOptions
. This thread creates some objects and populates the model as the rest of the app continues to load (because I don't block, and didFinishLaunchingWithOptions
returns YES
). I also put up a loading UIViewController 'on top' of the main view that I tear down after the background initialization is complete.
My problem is that I need to notify the first view (call it the Home
view) that the model is ready, and that it should populate itself. The trick is that the background download could have finished before Home.viewDidAppear
is called, or any of the other Home.initX
methods.
I'm having difficulty synchronizing all of this and I've thought about it long enough that it feels like I'm barking up the wrong tree.
Are there any patterns here for this sort of thing? I'm sure other apps start by performing lengthy operations with loading screens :)
Thanks!
© Stack Overflow or respective owner