I am doing the following things to make sure that my application launches only after it gets a location update for the user.
1) My app delegate implements CLLocationManagerDelegate
2) In my app delegate didFinishLaunchingWithOptions method, I am doing
[locationManager startUpdatingLocation]
where locationManager is CLLocationManager instance and then returning YES
3) in my app delegate implemented this method
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
4) Now when didUpdateToLocation methods get called I do
[self.window addSubview:myViewController.view];
[self.window makeKeyAndVisible];
5) I have a splash page also
So this is what I see, the splash page appears for a second or two and then a plain white window appears for a second or so and then I see my myViewController.view
I want to avoid that white plain window to appear, I know it appears because in that time my phone is trying to update user current location, but I would like it to keep displaying the splash screen during that time instead of displaying the white plain window.
Add an image view with the same image you use as your splash screen to the window in MainWindow.xib.
(PS: what a horrible user experience! What will you do if the location manager fails to get a location fix? Or if it takes 30 seconds to get one? Whatever you do, your users will be gone.)