Having the same issue. In the meantime, I am using a small Bash script that takes a GPX file as an argument and sends the locations within that file once a second to the simulator. Here it is in case anyone needs it:
`#!/bin/bash
# Function to send the coordinates to the Xcode simulator
send_coordinate_to_simulator() {
latitude=$1
longitude=$2
echo "Sending coordinate: Latitude = $latitude, Longitude = $longitude"
xcrun simctl location booted set "$latitude","$longitude"
}
# Function to extract coordinates from the GPX file and send them to the simulator
simulate_gpx_coordinates() {
gpx_file=$1
# Use grep and awk to extract latitude and longitude from the GPX file
# Assuming the <wpt> elements in GPX look like: <wpt lat="***" lon="yyy">
while true; do
grep "<wpt" "$gpx_file" | while read -r line ; do
latitude=$(echo "$line" | awk -F'"' '{print $2}')
longitude=$(echo "$line" | awk -F'"' '{print $4}')
# Send the coordinates to the simulator
send_coordinate_to_simulator "$latitude" "$longitude"
# Wait for 1 second before sending the next coordinate
sleep 1
done
# When the loop finishes, it will start again from the beginning
echo "Restarting simulation from the first coordinate..."
done
}
# Function to handle script termination on Ctrl+C (SIGINT)
handle_exit() {
echo -e "\nStopping location simulation. Exiting..."
exit 0
}
# Trap Ctrl+C (SIGINT) and call handle_exit
trap handle_exit SIGINT
# Check if a GPX file was provided as an argument
if [[ $# -eq 0 ]]; then
echo "Usage: $0 <path_to_gpx_file>"
exit 1
fi
gpx_file=$1
# Check if the GPX file exists
if [[ ! -f "$gpx_file" ]]; then
echo "GPX file not found: $gpx_file"
exit 1
fi
# Simulate the GPX coordinates in an infinite loop
simulate_gpx_coordinates "$gpx_file"`