location_set
Simulate a GPS location on an iOS simulator by providing latitude and longitude coordinates. This is essential for testing location-aware features such as maps, geofences, weather, and region-specific content without physically moving. The simulated location persists until explicitly cleared or the simulator is rebooted.
Parameters
Section titled “Parameters”| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
deviceId | string | Yes | — | The UDID of the target simulator (must be booted). |
latitude | number | Yes | — | The latitude coordinate to simulate (range: -90 to 90). |
longitude | number | Yes | — | The longitude coordinate to simulate (range: -180 to 180). |
Usage Examples
Section titled “Usage Examples”Set location to Apple Park, Cupertino
Section titled “Set location to Apple Park, Cupertino”“Set the simulator location to Apple Park”
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "latitude": 37.3349, "longitude": -122.0090}Set location to Tokyo Tower, Japan
Section titled “Set location to Tokyo Tower, Japan”“Simulate the device being in Tokyo”
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "latitude": 35.6586, "longitude": 139.7454}Set location to London, UK
Section titled “Set location to London, UK”“I need to test the app as if the user is in London”
{ "deviceId": "F3A1B2C3-D4E5-6789-ABCD-EF0123456789", "latitude": 51.5074, "longitude": -0.1278}Example Output
Section titled “Example Output”Location set successfully.Device: iPhone 16 Pro (F3A1B2C3-D4E5-6789-ABCD-EF0123456789)Latitude: 37.3349Longitude: -122.0090Related Tools
Section titled “Related Tools”location_clear— Remove the simulated location and revert to defaultsimulator_list— Find simulator UDIDs for thedeviceIdparametersimulator_boot— Boot a simulator before setting location