iphone how to make sure that application launches only after it gets the user locationn
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 didFinis开发者_StackOverflow社区hLaunchingWithOptions 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.)
You will have to code to display a copy of the splash screen.
but you also need to consider that the user may decline the Location service permission prompt or not be in a good GPS coverage area or in Airplane mode.
I agree with others here. It can be faked, but this is terrible for the user.
If you application absolutely cannot function without user location I would suggest presenting some screen indicating that the application is locating the user. And if it fails to do so, let the user know this.
Simply making it look like the application take 30 seconds to load is going to turn away many users. So if nothing else please let them know that something is happening back there. (Or better yet, find some way of presenting useful parts of the application while the location is being determined if the app functionality allows it)
精彩评论