react-native-geolocation
react-native-geolocation copied to clipboard
iOS getCurrent position only works on first call, also issues with watchPosition
Environment
System: OS: macOS Mojave 10.14.6 CPU: (4) x64 Intel(R) Core(TM) i5-3210M CPU @ 2.50GHz Memory: 21.92 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 8.12.0 - /usr/local/bin/node Yarn: 1.17.3 - /usr/local/bin/yarn npm: 6.9.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 13.1, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0 Android SDK: API Levels: 28, 29 Build Tools: 28.0.3, 29.0.1 System Images: android-28 | Intel x86 Atom_64, android-28 | Google APIs Intel x86 Atom, android-29 | Google APIs Intel x86 Atom IDEs: Android Studio: 3.4 AI-183.6156.11.34.5692245 Xcode: 11.1/11A1027 - /usr/bin/xcodebuild npmPackages: react: 16.10.2 => 16.10.2 react-native: 0.61.2 => 0.61.2 npmGlobalPackages: react-native-cli: 2.0.1
Platforms
iOS
Versions
- Android: --
- iOS: 12 and 13
- react-native-geolocation: 2.0.2
- react-native: 0.61.2 / also had on 0.59.9
- react: 16.10.2
Description
Hi, I'm getting a problem with getting location on iOS, tested on both iOS 12 and 13, real iPhone 7 and iPhone 8 and 11 Pro in the simulator.
My issue is that getCurrentPosition only works the first time I request it, after that one time it begins timming out on all requests, and watchPosition only works two/three consecutive times, and then stops giving more position changes.
Same for me !
Same for me, it doesn't work also for iPhone X
The behavior I'm observing in iOS 13.2 simulator
- Open app in the simulator
- Get Location
- Kill app
- Change location in 'Debug menu'
- Open App
- App returns the previous location
- Kill App
- Open App
- App returns correct location
I think it may have something to do with this code here: https://github.com/react-native-community/react-native-geolocation/blob/master/ios/RNCGeolocation.m#L311-L318
@scgrossman Are you passing a maximumAge to the request? Seems like the code will cache the position, by default it's FOREVER! Seems like a ridiculous default.
https://github.com/react-native-community/react-native-geolocation#getcurrentposition
in componentWillUnmount()
, don't forget to call Geolocation.stopObserving()
still happening for me as well, I set the location for my iOS sim using Debug -> Location -> Custom Location and it does not get picked up, it uses a cached value from somewhere. any fix for this?
Any updates on this? I think it is a serious issue.
Still relevant
any update?
Hi Guys, if you have the When in Use and the Always permission request on iOS, the App for some reason is waiting for the Always permission, so, I deleted the Always Usage Description Key pair in the info.plist because my app doesn't need it and then my app works perfectly.
Good luck!
This problem is still present and unresolved ...