Wrong Geolocation with React Native and iOS simulator

为君一笑 提交于 2019-12-01 09:03:37

That is the correct behavior on the iOS simulator (and the Android emulator). You can change the mocked coordinates for geolocation on each like so (paraphrased from other answers):

iOS

  1. Run app in iOS simulator.
  2. At the top menu bar, you'll find Debug -> Location -> Custom Location..(or you can choose to use others).
  3. Set the Latitude & Longitude for the location.

Android

  1. Run app in Android emulator.
  2. Click on the ellipsis (...) in the toolbar.
  3. Edit the coordinates in the newly opened settings under Location.

There's also a command line alternative for Android explained here using telnet and the geo fix command.

Or, you can do as ashutosh pandey suggests and test on a real device.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!