Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Request permissions again after user denies location services?

I track the user's location and ask for permission when my load first loads using this:

locationManager.requestAlwaysAuthorization() locationManager.startUpdatingLocation() 

If the user denies, but later changes their mind by enabling the configuration option in my app, how do I ask again? For example, I have a switch for auto detecting the user's location so when they enable it, I am trying to do this:

@IBAction func gpsChanged(sender: UISwitch) {     // Request permission for auto geolocation if applicable     if sender.on {         locationManager.requestAlwaysAuthorization()         locationManager.startUpdatingLocation()     } } 

But this code doesn't seem to do anything. I was hoping it would ask the user again if they want to allow the app to track the user's location. Is this possible?

like image 775
TruMan1 Avatar asked May 01 '15 02:05

TruMan1


People also ask

How do I ask for permission again IOS?

The OS will only ever prompt the user once. If they deny permission, that's it. What you can do is direct the user to the Settings for your app by passing UIApplicationOpenSettingsURLString to UIApplication 's openURL: method. From there, they can re-enable location services if they wish.

What is Cllocationmanager in Swift?

The object that you use to start and stop the delivery of location-related events to your app.

Where do I find permissions on my iPhone?

How to check app permissions on your iPhone. To check your app permissions, go to Settings —> Privacy. A list of different categories, such as Location Tracking, Bluetooth, Contacts, Microphone, Photos, and more will appear. You can click on each specific category to see which apps have access to that data.


1 Answers

The OS will only ever prompt the user once. If they deny permission, that's it. What you can do is direct the user to the Settings for your app by passing UIApplicationOpenSettingsURLString to UIApplication's openURL: method. From there, they can re-enable location services if they wish. That said, you probably shouldn't be too aggressive about bugging them for the permission.

like image 77
bgilham Avatar answered Sep 19 '22 04:09

bgilham