Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS: Geolocation with NSLocationAlwaysUsageDescription #4886

Closed
onchainguy-btc opened this issue Dec 20, 2015 · 5 comments
Closed

iOS: Geolocation with NSLocationAlwaysUsageDescription #4886

onchainguy-btc opened this issue Dec 20, 2015 · 5 comments
Labels
Resolution: Locked This issue was locked by the bot.

Comments

@onchainguy-btc
Copy link
Contributor

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

@facebook-github-bot
Copy link
Contributor

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-native or 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!

@christopherdro
Copy link
Contributor

@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.

@onchainguy-btc
Copy link
Contributor Author

@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:

  1. Add NSLocationWhenInUseUsageDescription to my plist file
  2. Deploy to my real device
  3. Get asked for permissions
  4. Uninstall the app from my real device
  5. Change the key in my plist file to NSLocationAlwaysUsageDescription
  6. Deploy to my real device
  7. Not receiving any request for permissions
  8. Uninstall again and redeploy with NSLocationWhenInUseUsageDescription
  9. Get asked for the permissions again

@onchainguy-btc
Copy link
Contributor Author

When I test this on master NSLocationAlwaysUsageDescription does not get ignored but throws an error message.

image

@brentvatne
Copy link
Collaborator

@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! 🚀

onchainguy-btc added a commit to elbstack/react-native that referenced this issue Jan 3, 2016
On iOS the plist key NSLocationAlwaysUsageDescription was ignored and the location could not be retreived when using this key. Now both keys NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription are supported. If NSLocationAlwaysUsageDescription is set, NSLocationWhenInUseUsageDescription will be simply ignored according to https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW18
onchainguy-btc added a commit to elbstack/react-native that referenced this issue Jan 3, 2016
On iOS the plist key NSLocationAlwaysUsageDescription was ignored and the location could not be retreived when using this key. Now both keys NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription are supported. If NSLocationAlwaysUsageDescription is set, NSLocationWhenInUseUsageDescription will be simply ignored according to https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW18
ghost pushed a commit that referenced this issue Jan 12, 2016
Summary:
brentvatne this is the pull request you requested
See issue #4886

On iOS the plist key NSLocationAlwaysUsageDescription was ignored and the location could not be retreived when using this key. Now both keys NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription are supported. If NSLocationAlwaysUsageDescription is set, NSLocationWhenInUseUsageDescription will be simply ignored according to https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW18

I read the contribution guidelines regarding the Objective-C coding standards. Hopefully my line length breaks are okay - otherwise just give me a shout and I will fix that. Didn't write any line of Objective-C before so^^
Closes #5093

Reviewed By: svcscm

Differential Revision: D2823206

Pulled By: nicklockwood

fb-gh-sync-id: dd856a18416796749025e4b32d9c72895401916d
christopherdro pushed a commit to wildlifela/react-native that referenced this issue Jan 20, 2016
Summary:
brentvatne this is the pull request you requested
See issue facebook#4886

On iOS the plist key NSLocationAlwaysUsageDescription was ignored and the location could not be retreived when using this key. Now both keys NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription are supported. If NSLocationAlwaysUsageDescription is set, NSLocationWhenInUseUsageDescription will be simply ignored according to https://developer.apple.com/library/ios/documentation/General/Reference/InfoPlistKeyReference/Articles/CocoaKeys.html#//apple_ref/doc/uid/TP40009251-SW18

I read the contribution guidelines regarding the Objective-C coding standards. Hopefully my line length breaks are okay - otherwise just give me a shout and I will fix that. Didn't write any line of Objective-C before so^^
Closes facebook#5093

Reviewed By: svcscm

Differential Revision: D2823206

Pulled By: nicklockwood

fb-gh-sync-id: dd856a18416796749025e4b32d9c72895401916d
@facebook facebook locked as resolved and limited conversation to collaborators Jul 20, 2018
@react-native-bot react-native-bot added the Resolution: Locked This issue was locked by the bot. label Jul 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Resolution: Locked This issue was locked by the bot.
Projects
None yet
Development

No branches or pull requests

5 participants