[英]Ask for New App Permission
I added a feature in my app that requires the background location permission on ios. 我在应用程序中添加了一项功能,该功能需要ios上的后台位置许可。 How do I re-request the location permission to allow 'Always' vs 'While Using'?
如何重新请求位置许可以允许“始终”与“正在使用”?
Clarification: My app already requests the 'While Using' permission level. 澄清:我的应用程序已请求“使用时”权限级别。 With the new feature I need users to up the permission to be 'Always'.
有了新功能,我需要用户批准“始终”权限。 However, right now when installing the update over a pre-existing app, ios isn't promiting the higher level permission and the only way to change it is by going into the Settings app.
但是,现在在通过现有应用程序安装更新时,ios不允许更高级别的权限,唯一的更改方法是进入“设置”应用程序。
Add to the /platforms/ios/{project}/{project}-Info.plist
file these lines: 将这些行添加到
/platforms/ios/{project}/{project}-Info.plist
文件中:
<key>NSLocationAlwaysUsageDescription</key>
<string>[App Name] would like to access your location when running.</string>
For 'While Using' your key has to be: NSLocationWhenInUseUsageDescription
. 对于“使用时”,您的密钥必须为:
NSLocationWhenInUseUsageDescription
。
The way I solved this was to check if the permission is not set to 'Always'. 我解决此问题的方法是检查权限是否未设置为“始终”。 Then if it's not, explain to the user why it needs to be set to 'Always' and then linking them to their settings to change it.
然后,如果不是,请向用户说明为什么需要将其设置为“始终”,然后将其链接到其设置以进行更改。
As far as I can tell there is no real way to re-trigger asking for a higher permission on iOS. 据我所知,没有真正的方法可以重新触发,要求在iOS上获得更高的权限。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.