问题
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