how to test geolocation on simulator

两盒软妹~` 提交于 2019-12-19 12:42:14

问题


I'm starting with geocoding, and after read a few things I realize that are some people using the simulator for testing their code.

Is that possible!?? Can someone tell which tools use!? (it's better than walking around)

Thanks


回答1:


XCode 4.2 with iOS 5 now supports "Location simulation", you can refer it HERE.

Steps to use this feature:

  1. Build & run your app in iPhone 5.0 Simular.
  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.



回答2:


As of iOS 5 and Xcode 4.1 is is now possible to test location in the simulator, There are also premade classes for this such as : https://github.com/progrmr/CLLocationManager-simulator




回答3:


To add to Kjuly's answer, if it throws error such as "code":2 for me, then try to put instead of Debug->Location->Custom location the other option such as Apple, City Run etc. For me it dropped out the error and then you can turn back to Custom location.

Found this helpful on: Geolocation is not working in iOS 8 simulator



来源:https://stackoverflow.com/questions/8819312/how-to-test-geolocation-on-simulator

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