iOS 11 Location permission with three options from the beginning

こ雲淡風輕ζ 提交于 2021-02-19 07:53:47

问题


I am trying to ask for location permission on iOS 11 with React Native. There is a change from Apple coming with iOS 11 where we have a third option for using the location permission only when using the app. Our app is location based and need the user's coordinates even when the app is in the background so I would like the user to have the option to click 'Always' the first time the popup shows up. The problem is that the only popup which shows up is not having the three options (the first image below). The second image for iOS 11 is showing the three options which I am trying to achieve. I have added the new Privacy settings to the Info.plist as shown in the third image.


回答1:


With iOS 10, to ask a always permission of location, use the key as NSLocationAlwaysUsageDescription

=> You use the wrong key as NSLocationUsageDescription

With iOS 11, to ask a always permission of location, you need 2 keys as NSLocationWhenInUseUsageDescription and NSLocationAlwaysAndWhenInUseUsageDescription

=> You have done this part.



来源:https://stackoverflow.com/questions/46450080/ios-11-location-permission-with-three-options-from-the-beginning

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!