简体   繁体   中英

Ask for New App Permission

I added a feature in my app that requires the background location permission on 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.

Add to the /platforms/ios/{project}/{project}-Info.plist file these lines:

<key>NSLocationAlwaysUsageDescription</key>
<string>[App Name] would like to access your location when running.</string>

For 'While Using' your key has to be: 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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