What I can do:
Take a sqlite DB of 100 lat and lng points, and drop those pins on a map. Looks GREAT!
What I would like to do is get my location, BEFORE I draw my map. But it seems that:
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
ALWAYS fires off AFTER (void)viewDidLoad runs. NO MATTER where I insert it.
What i need to do is have a splash screen, STOP there until I get a location, use that lat and lng to search my sqlite DB of locations within so many miles of me.
Here my trace:
Entering -[RootViewController initWithTabBar]
Entering -[RootViewController viewDidLoad]
Entering -[RootViewController locationManager:didUpdateToLocation:fromLocation:]
And here's what I really want:
Entering -[RootViewController initWithTabBar]
Entering -[RootViewController locationManager:didUpdateToLocation:fromLocation:]
Entering -[RootViewController viewDidLoad]
Now I'm thinking (working with a tabbarcontroller), do somehow I have to push this all the way back to my app delegate? Freeze the entire app until I get a location? That's my latest thoughts.
thanks for any tips, leads, snippets … !!! I've been looking for days, no luck at all.
thanks!!!!
Best Answer
You definitely don't want to "freeze" the app, and you definitely want to do as little work in your app delegate's
applicationDidFinishLaunching:
method as possible. What I might recommend:UIActivityIndicatorView
, or something like that.You could also add both views, and just flip their
hidden
properties at the right time. But the point is to give the user something to look at, while not trying to fight the inherently asynchronous nature of Core Location.