React-native: Geolocations say: Unable to retrieve location PERMISSION DENIED

Created on 8 Apr 2015  路  13Comments  路  Source: facebook/react-native

[email protected]

navigator.geolocation does not seem to work. I've ensured I am selecting ALLOW in the simulator, and I've set the custom cords to be Lat: 55.02 Lng: -1.42 but still getting the error PERMISSION DENIED

It also appears that all my linkages are correct:
Linkages

Locked

Most helpful comment

@iDVB - that happened to me and then I went into Debug > Location and chose Apple, pressed CMD+r to reload and it worked. Then switching to a custom location worked too, after that. Let me know if that helps!

All 13 comments

https://facebook.github.io/react-native/docs/geolocation.html#content - "/!\ ATTENTION /!\ You need to add NSLocationWhenInUseUsageDescription key in Info.plist to enable geolocation, otherwise it's going to fail silently! !/ !/" - did you do this?

We should probably have the native module check whenever NSLocationWhenInUseUsageDescription is set and show warning / redbox. Anyone wants to send a quick PR? :)

@frantic - on it, PR coming!

@iDVB - confirmed that with custom location set and NSLocationWhenInUseUsageDescription configured, this works:

screen shot 2015-04-08 at 3 15 11 pm

Looks like that value is indeed set.
value

BTW, the code I'm using is from this tutorial.

Here is a video of it happening.

@iDVB - that happened to me and then I went into Debug > Location and chose Apple, pressed CMD+r to reload and it worked. Then switching to a custom location worked too, after that. Let me know if that helps!

WORKS! Kinda fiddly setup though. Not even sure what fixed it as I did, multiple refreshes, restarts of the Simulator and swapping the location from custom to Apple and back.
Thanks for the help.

I also keep getting "permission denied" even with NSLocationWhenInUseUsageDescription in the Info.plist. Using react-native 0.17.0

I have uninstalled the app in the simulator and selected "allow" when asked if it can access my location while I use the app.

The location is set to "Apple". I toggled that to different locations also.

Restarting the simulator helped me fix this issue

navigator.geolocation.watchPosition through permission denied in Android OS>5

Problem still occur for me.
NSLocationAlwaysUsageDescription & NSLocationWhenInUseUsageDescription are set

The info.plist need NSLocationAlwaysAndWhenInUseUsageDescription & NSLocationAlwaysUsageDescription aswell

Isn't this correct?

     <key>NSLocationAlwaysUsageDescription</key>
<string>Some description</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>Some description</string>
Was this page helpful?
0 / 5 - 0 ratings