Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add description to Permission modal alert

How to specify why the app is requesting access to the location? I would like to clarify the use of location in permission modal alert.

like image 287
mrisek Avatar asked Dec 11 '17 09:12

mrisek


3 Answers

Just go to your info.plist and add the following keys

enter image description here

String that you provide to these keys will be picked appropriately by iOS to show the message of the dialog when you request for user permission to access the location.

Which message will be picked will be decided dynamically based on what kind of permission you are asking for. Eg : when you ask for Location Always permission its corresponding message will be picked and vice versa when you use location when in use.

Hope it helps

like image 190
Sandeep Bhandari Avatar answered Dec 23 '22 18:12

Sandeep Bhandari


Open your plist with source code, and add below 

<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    <string>Message for Always and when used desc</string>   
    <key>NSLocationAlwaysUsageDescription</key>
    <string>Message for Always used desc</string>   
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>Message for when used desc</string>
like image 40
Jeetendra Kumar Avatar answered Dec 23 '22 17:12

Jeetendra Kumar


For iOS Devices you need to specifiy NSLocationAlwaysUsageDescription or NSLocationWhenInUseUsageDescription directly in your Info.plist file in xCode. After that iOS will automatically manage to show your specified message in an alert.

like image 36
Tim Avatar answered Dec 23 '22 17:12

Tim