Add description to Permission modal alert

10,368

Solution 1

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

Solution 2

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>

Solution 3

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.

Share:
10,368
mrisek
Author by

mrisek

My goal is to further improve team leadership and project management skills, as well as programming skills in various technologies with a focus on entrepreneurial and innovative aspects of ICT.

Updated on July 28, 2022

Comments

  • mrisek
    mrisek almost 2 years

    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.

  • Dan
    Dan about 6 years
    I found this comment more useful for doing this with react-native