Re: iOS: "This application needs location services / Allow / Don't Allow" alert
Re: iOS: "This application needs location services / Allow / Don't Allow" alert
- Subject: Re: iOS: "This application needs location services / Allow / Don't Allow" alert
- From: David Duncan <email@hidden>
- Date: Wed, 01 Feb 2012 09:52:33 -0800
On Feb 1, 2012, at 12:09 AM, John Michael Zorko wrote:
> I've an issue that i'm trying to solve, and i've run into several walls. This app i'm working on requires Core Location, and on first install, iOS displays it's "this app needs location services / Allow / Don't Allow" alert. That's fine, but the issue is that my app's window's root view controller's viewDidLoad is called before the iOS-supplied alert is dismissed, and said viewDidLoad checks to see if CL is enabled and shows it's own alert if not. The result: once the user dismisses the iOS-supplied alert by tapping Allow, the alert that my view controller created is shown (because when my view controller did the CL check, the user hadn't dismissed the iOS-supplied alert yet, so CL was not enabled at the time).
It sounds like your enabled/authorized check is incorrect. You should check both locationServicesEnabled and authorizationStatus. If location services are disabled, then just start checking for location services (and wait for the authorization status change as Fritz mentioned).
If location services are enabled, then check your authorization status and act appropriately based on the status. kCLAuthorizationStatusNotDetermined means we haven't asked the user yet, kCLAuthorizationStatusRestricted means that the user cannot change the current status, and kCLAuthorizationStatusDenied/Authorized have the obvious meaning.
--
David Duncan
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden