0

In my app I have both of these lines:

manager.requestAlwaysAuthorization()
UNUserNotificationCenter.current().requestAuthorization(options: [.sound,.alert], completionHandler: {didAllow, error in}) 

But when loaded, my application only requests permission for notifications. My app wouldn't work without the user giving permission to use its location. How can I fix this?

Paul John
  • 115
  • 8
  • Possible duplicate of [requestAlwaysAuthorization not showing permission alert](http://stackoverflow.com/questions/26005122/requestalwaysauthorization-not-showing-permission-alert) – LC 웃 Apr 25 '17 at 07:39

2 Answers2

0

I can do assumption that you already grant permission or denied it. To verify it try to run this code:

let status = CLLocationManager.authorizationStatus()

And detect status of the CLLocationManager now you will know what kind of state it is.

If state is notDetermined ask for the permission in this way.

Oleg Gordiichuk
  • 15,240
  • 7
  • 60
  • 100
0

Make sure that NSLocationAlwaysUsageDescription key is present and has a string value in your Info.plist, otherwise location permission dialog wont appear

Zell B.
  • 10,266
  • 3
  • 40
  • 49