I want to make application that will use GPS, as we know at first time user use our application that need gps/current location, there is a pop up that asking for permission, the problem is.. example:
the user choose not allow, and then how can we know the user make our application can’t access to her/his gps to know his/her location? because my application need CurrentLocation, so if I can detect what user choose, I want to make a Pop Up like first Pop Up that asking for permission again.
or any code that can make gps turn on/off by my application?
Imagine if the user does not allow by mistake? Is there away for my application to reask the user?
What should application like Yelp do when location is not available?
As of iOS 4.2, the class on which you’re implementing CLLocationManagerDelegate’s methods (like
-locationManager:didUpdateToLocation:fromLocation:) should also implement-locationManager:didChangeAuthorizationStatus:. There are four statuses that that method will receive; to check for your app being unable to use location services, look forkCLAuthorizationStatusRestricted—when the user is unable to allow access to location services—andkCLAuthorizationStatusDenied—when the user has explicitly refused your application access to location services. In both cases, the appropriate thing to do is to inform the user (via an alert view or whatever) that your application relies on being able to access their location and that they may be able to re-grant it that access in the Settings app. You can also check your app’s authorization status at any time using the CLLocationManager class method+authorizationStatus.Pre-4.2, unfortunately, none of that is available, and you’ll need to use the
+locationServicesEnabledmethod that sosbom’s answer mentions.