iOS: Geolocation with NSLocationAlwaysUsageDescription
I use version 0.17.0 of React Native
Geolocation works for me if I use NSLocationWhenInUseUsageDescription like mentioned in the documentation on https://facebook.github.io/react-native/docs/geolocation.html. Unfortunately it doesn't ask for the permissions if I specify NSLocationAlwaysUsageDescription in my Info.plist. Is this a known issue?
Could also be related to #4879
Hey seb0zz, thanks for reporting this issue!
React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
- If you don't know how to do something or not sure whether some behavior is expected or a bug, please ask on StackOverflow with the tag
react-nativeor for more real time interactions, ask on Discord in the #react-native channel. - If this is a feature request or a bug that you would like to be fixed, please report it on Product Pains. It has a ranking feature that lets us focus on the most important issues the community is experiencing.
- We welcome clear issues and PRs that are ready for in-depth discussion. Please provide screenshots where appropriate and always mention the version of React Native you're using. Thank you for your contributions!
@seb0zz I think if you've accepted Location permissions once it won't ask you again unless you clear the settings.
It might be easier to just setup a new app and test NSLocationAlwaysUsageDescription.
I've used this in the past and it worked fine so you shouldn't have any problems.
@christopherdro That was my first thought, too. So I tested my app on a real iOS device. I am now able to reproduce the problem by the following steps:
- Add
NSLocationWhenInUseUsageDescriptionto my plist file - Deploy to my real device
- Get asked for permissions
- Uninstall the app from my real device
- Change the key in my plist file to
NSLocationAlwaysUsageDescription - Deploy to my real device
- Not receiving any request for permissions
- Uninstall again and redeploy with
NSLocationWhenInUseUsageDescription - Get asked for the permissions again
When I test this on master NSLocationAlwaysUsageDescription does not get ignored but throws an error message.

@seb0zz - you can add both and NSLocationWhenInUseUsageDescription will be ignored - https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW18
If you want to fix this, it should be a very easy PR :) https://github.com/facebook/react-native/blob/master/Libraries/Geolocation/RCTLocationObserver.m#L328-L333 - just update this block to check for either of them. I will merge right away! :rocket: