Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
465 views
in Technique[技术] by (71.8m points)

ios - Simulating location updates on the iPhone Simulator

I want to allow users to set the GPS information on the iPhone Simulator via GUI.

But I'm not sure how to archieve this - it seems that this tool called iSimulate does this somehow by installing an own SDK. But I can't figure out how they "override" / "hack" the simulator by that.

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Added a second answer since there are now integrated features in Xcode (≥4.2). There are two ways to simulate location updates:

  • In the iOS Simulator, under "Debug/Location" you're able to specify a constant latitude/longitude or select several predefined profiles like "City Run" or "Freeway Drive".
  • In Xcode there's a new location icon in the debugger, right next to the Step Out button. It lets you select several hardcoded cities worldwide and add a custom GPX file to your project. The nice thing about location simulation in Xcode is that it also works on the device (just don't forget to turn it off again otherwise your auto timezone will be wrong!). The custom GPX file is nice, too, although it sometimes crashes Xcode if the GPX file is not recognized. Make sure you use <wpt> tags only:
<?xml version="1.0"?>
<gpx version="1.1" creator="Xcode"> 
  <wpt lat="47.52789018096815" lon="7.385249894876031"></wpt>
  <wpt lat="47.52720984945248" lon="7.382647784661411"></wpt>
  ...
</gpx>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...