In my application I am using CLLocation
services in one of my ViewController
.
Should I ask user for permission in appdelegate
or in that particular ViewController
.
If I add permission request code in particular ViewController
it will not ask permission until user navigate
to that view controller.
Is this correct implementation?
Asked
Active
Viewed 59 times
-2

rmaddy
- 314,917
- 42
- 532
- 579

Sangram Shivankar
- 3,535
- 3
- 26
- 38
-
1You can ask for permission from user in particular view controller. If user denies and you need it to move ahead, show an alert with error and navigate back to previous screen. This would be an ideal approach. – manishsharma93 Jun 28 '19 at 11:18
1 Answers
0
You should ask the user for permission, when the GPS functionality is actually required, so I would do this in the ViewController and not in the AppDelegate.

inexcitus
- 2,471
- 2
- 26
- 41
-
-
Then I would ask the user for permission and only add the compass if the user has granted access to use GPS. Add a generic information view instead (if the user did not grant permission). – inexcitus Jun 28 '19 at 11:17