How-To: Detect if users have turned off the iPhone GPS

Simple and common situation.  You have an app that needs to use the GPS to function correctly.  However, users have the last say in this and can simply say “No” when the iPhone asks them if your application asks to turn on the GPS.  If you don’t deal with this situation, then it’s likely that Apple will reject your application.

So what to do?  Simple, implement the following CLLocationManager delegate method:

- (void)locationManager:(CLLocationManager *)manager 
       didFailWithError:(NSError *)error

Inside this method, make sure you deal with not receiving any GPS locations in a sensible manner (show a popup, skip etc).

Leave a Reply