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 API not work on RN 0.50.3 #16928

Closed
jacobchen opened this issue Nov 22, 2017 · 3 comments
Closed

[iOS] Geolocation API not work on RN 0.50.3 #16928

jacobchen opened this issue Nov 22, 2017 · 3 comments
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.

Comments

@jacobchen
Copy link

Is this a bug report?

Yes

Environment

OS:  macOS Sierra 10.13.1
Node:  8.9.1
Yarn:  0.21.3
npm:  5.5.1
Xcode:  Xcode 9.1 Build version 9B55

react-native: 0.50.3
react: 16.0.0
Test device: Simulator iPhone6s / iOS11

Steps to Reproduce

  1. create a pure app with command: react-init geoTest

  2. Setup the app as following: include NSLocationAlwaysUsageDescription and NSLocationWhenInUseUsageDescription in the info.plist, add location as a background mode in the 'Capabilities' tab in Xcode

  3. Add code as below:

componentDidMount() {
     navigator.geolocation.getCurrentPosition(
          (position) => {
            console.log("position.coords: ", position.coords);
          },
          (error) => this.setState({ error: error.message }),
          { enableHighAccuracy: true, useSignificantChanges: true, distanceFilter:10, timeout: 20000, maximumAge: 1000 },
        );
}

Below error message show up:

TypeError: Cannot read property 'geolocation' of undefined

@ProteanDev
Copy link

ProteanDev commented Nov 24, 2017

Yeah I'm having this issue too. I haven't found a way around it yet. I am using react-native-maps though, not sure yet if that has something to do with that. The same thing happen in android.

@hawkup
Copy link

hawkup commented Dec 1, 2017

Have you tried remove /node_modules and install again yet?

@stale
Copy link

stale bot commented Jan 30, 2018

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Maybe the issue has been fixed in a recent release, or perhaps it is not affecting a lot of people. If you think this issue should definitely remain open, please let us know why. Thank you for your contributions.

@stale stale bot added the Stale There has been a lack of activity on this issue and it may be closed soon. label Jan 30, 2018
@stale stale bot closed this as completed Feb 6, 2018
@facebook facebook locked and limited conversation to collaborators May 15, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Stale There has been a lack of activity on this issue and it may be closed soon.
Projects
None yet
Development

No branches or pull requests

3 participants