Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CLLocation ask again for permission

Currently my application asks only once for permission to use the current location. If the user doesn't allow, he isn't ask again unless he resets location warning in the general settings. I would like to give the user a chance from within the app to grant this permission later. In other words, the dialog should appear again if he presses a certain button. Is this possible?

Thanks for your advice.

like image 438
Reinhold Avatar asked Nov 22 '10 12:11

Reinhold


1 Answers

[CLLocationManager locationServicesEnabled] just tells you if the locations services are enable on the device.

according to this document.

[CLLocationManager authorizationStatus]

will return one of these

typedef enum {
   kCLAuthorizationStatusNotDetermined = 0,
   kCLAuthorizationStatusRestricted,
   kCLAuthorizationStatusDenied,
   kCLAuthorizationStatusAuthorized
} CLAuthorizationStatus;

if the result is kCLAuthorizationStatusDenied your could tell the user to allow the usage of the location services by sending him to the settings.app

like image 183
Pierre Avatar answered Oct 14 '22 11:10

Pierre