Ask users to allow access to their location using iOS when mapView does

I developed the application using MapView - when the application starts, it will ask the user to allow access to their location / use without any encoding from me. Is this enough for permission, or should I also ask the user and provide a reason for access? Will Apple reject the application when submitted unless I specifically make a request and allow MapView to request it on my behalf?

+4
source share
3 answers

You do not need to ask the user for permission, iOS does this automatically for you.

You must set the target string property in the CLLocationManager so that when prompted by the system, it can also tell the user why you want their location.

locationManager.purpose = @"Location needed to show zombies that are nearby."; 

Set this property before calling startUpdatingLocation so that it displays to the user in a system alert requesting permission to use the location.

As a delegate, you can implement the locationManager: didChangeAuthorizationStatus: method to find out if the user is allowed to host the kernel or not.

+12
source

As in iOS 6, the correct place for the “target” message is in the Info plist file.

The NSLocationUsageDescription property must be set with a message to display to users.

Apple provides good documentation: https://developer.apple.com/library/mac/#documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html

+11
source

You do not need to tell the user why their location is available, especially if the application is based on location and map. With this in mind, it’s nice to tell the user exactly what you’ll do with their data before the pop-up permission window appears, so I hope more users agree.

0
source

Source: https://habr.com/ru/post/1438415/


All Articles