$ xcrun simctl location
Control a device's simulated location
Usage: simctl location <device> <action> [arguments]
list
List available simulation scenarios.
clear
Stop any running scenario and clear any simulated location.
set <lat1>,<lon1>
Set the location to a specific latitude and longitude.
run <scenario>
Run a simulated location scenario (use the list action to get a list of scenarios).
start [--speed=<meters/sec>] [--distance=<meters per second>|--interval=<seconds>] <lat1>,<lon1> <latN>,<lonN>...
Set the location to a series of waypoints specified as 'lat,lon' pairs, interpolating between them over time.
At least two waypoints are required. Use '-' to read waypoints from stdin, one waypoint per line.
Speed specifies how quickly to move between waypoints in meters per second. If not specified 20m/s is used.
The system will issue location updates along the path between each pair of waypoints. Use distance or interval to
control how often those updates are issued. Distance will issue an update every <meters> travelled without regard
for the time between updates. Interval will issue updates at fixed times without regard for how much
the location moves between updates.
If neither are specified an interval of 1.0 seconds is used. If both are specified the system picks ones.
Example simulating a direct line between San Francisco and New York City, with updates every km:
set --distance=1000 --speed=260 37.629538,-122.395733 40.628083,-73.768254
Latitude and longitude pairs must be specified using '.' as the decimal separator and ',' as the field separator.
3条答案
按热度按时间ibps3vxo1#
可以通过set-simulator-location等工具在模拟器级别完成模拟位置
只需使用
brew install lyft/formulae/set-simulator-location
安装即可然后设置模拟器位置:
set-simulator-location -q Expo 624 University Ave Palo Alto CA
(设置为世博办公室)。9bfwbjaz2#
最后我用set-simulator-location-trip-simulator解决了我的问题,这是一个用set-simulator-location构建的工具,它允许你选择起点和终点,并模拟从起点到终点的旅程,但是它不允许使用gpx文件。
rta7y2nd3#
由于Xcode 14
simctl
提供了设置模拟器位置的可能性:要在gpx文件中使用它,您需要某种 Package 器来生成如下所示的命令(注意可能有N个坐标):
从我的研究来看,这提供了比我发现的所有其他工具多得多的功能,并且上级
lyft/formulae/set-simulator-location
。