繁体   English   中英

添加描述到权限模式警报

[英]Add description to Permission modal alert

如何指定应用程序请求访问该位置的原因? 我想澄清在权限模式警报中使用位置。

只需转到info.plist并添加以下密钥即可

在此输入图像描述

当您请求用户访问该位置的权限时,iOS将适当地选择您提供给这些键的字符串,以显示该对话框的消息。

将挑选哪条消息将根据您要求的权限进行动态决定。 例如:当您在使用位置时,当您在使用时使用位置时,将会选择其相应的消息,反之亦然。

希望能帮助到你

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>

对于iOS设备,您需要直接在NSLocationWhenInUseUsageDescription的Info.plist文件中指定NSLocationAlwaysUsageDescriptionNSLocationWhenInUseUsageDescription 之后iOS将自动管理以在警报中显示您指定的消息。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM