CLI for setting location in the iOS simulator

Overview

set-simulator-location

This is a simple CLI for easily setting the location of the currently running iOS Simulator.

Usage

Set a specific latitude and longitude:

$ set-simulator-location -c 37.7765 -122.3918

Or using place search:

$ set-simulator-location -q Lyft HQ San Francisco

By default the location is set on all booted simulators. If you'd like to change it for only one of the booted simulators you can pass -s followed by the simulator's display name:

$ set-simulator-location -q Lyft HQ San Francisco -s iPhone X

NOTE: If you have multiple booted simulators with the same name, the location will be set on all of them.

Installation

With homebrew:

$ brew install lyft/formulae/set-simulator-location

With Mint:

$ mint install lyft/set-simulator-location

With a precompiled release:

  1. Download the latest release from here
  2. Install it some place in your $PATH

Manually:

$ make install

I have submitted a Radar to have this behavior added to simctl.

Development

To work on set-simulator-location you can make your changes and run make to build from the command line. If you'd prefer to work in Xcode you can run make xcode to generate a project using SwiftPM.

Comments
  • Issue with Xcode 10.1

    Issue with Xcode 10.1

    I get the following message, when trying to set the location on a simulator running 12.1 using xcode 10.1 on macOS 10.14.

    set-simulator-location -c 40.741 -73.989

    No simulators are currently booted

    Issuing a xcrun simctl list -j devices command returns the following, only one device is booted.

      "devices" : {
        "iOS 12.1" : [
          {
            "availability" : "(available)",
            "state" : "Booted",
            "isAvailable" : true,
            "name" : "iPhone 5s",
            ...```
    
    opened by Rockwig-GSC 14
  • Please help me in installation

    Please help me in installation

    I had install HomeBrew and in currently in project directory. After run set-simulator-location -c 37.7765 -122.3918 command i got error

    xcrun: error: unable to find utility "simctl", not a developer tool or in PATH

    Running simctl list failed

    screen shot 2018-11-30 at 9 56 22 am

    opened by SURYAKANTSHARMA 8
  • Feature request: set altitude

    Feature request: set altitude

    Would it be possible to set altitude as well as coordinate?

    Replace parameter logic to accept three parameters and return CLLocationCoordinate3D instead of CLLocationCoordinate2D. https://github.com/lyft/set-simulator-location/blob/master/sources/coordinate.swift#L14

    opened by RobertSasak 6
  • Error: Your CLT does not support macOS 11.

    Error: Your CLT does not support macOS 11.

    It is either outdated or was modified. Please update your CLT or delete it if no updates are available. Update them from Software Update in System Preferences or run: softwareupdate --all --install --force

    If that doesn't show you an update run: sudo rm -rf /Library/Developer/CommandLineTools sudo xcode-select --install

    Alternatively, manually download them from: https://developer.apple.com/download/more/.

    alif@Saroars-MacBook-Pro Test % softwareupdate --all --install --force Software Update Tool

    Finding available software No updates are available. alif@Saroars-MacBook-Pro Test %

    opened by saroar 5
  • Add Xcode 9 support

    Add Xcode 9 support

    With the large number of simulator changes in Xcode 9 came a change where the notification we're hijacking needs to send along the UDIDs of the simulators where the change should take effect. This is because you can have multiple running simulators with different locations.

    To do this, for now, we're just reading the output of simctl list and sending all booted UDIDs along.

    opened by keith 5
  • Feature Request: Look up simulators by UDID

    Feature Request: Look up simulators by UDID

    It would be nice to have the option to look up the simulator by its UDID so we can automatically select the right simulator from the build scripts by using ${TARGET_DEVICE_IDENTIFIER}.

    Something like: "Usage: set-simulator-location [-c 0 0|-q San Francisco] [-s Simulator Name|-d Simulator UDID]"

    opened by qalandarov 2
  • Fix for Xcode 10.1

    Fix for Xcode 10.1

    Fixes an issue where set-simulator-location was failing to initialize its list of Simulators due to non-string values output by the newer version of xcrun shipped with Xcode 10.1. Also updates MapKit references for Swift 4.2.

    opened by igz 2
  • Altitude support

    Altitude support

    Logic is done, but I guess I am sending altitude with wrong parameter

    let userInfo: [AnyHashable: Any] = [
            "simulateLocationLatitude": location.coordinate.latitude,
            "simulateLocationLongitude": location.coordinate.longitude,
            "simulateLocationAltitude": location.altitude, // THIS line is I guess wrong
            "simulateLocationDevices": simulators,
        ]
    

    https://github.com/RobertSasak/set-simulator-location/blob/master/sources/notification.swift#L10

    opened by RobertSasak 1
  • Allow changing of a single simulator's location

    Allow changing of a single simulator's location

    This allows you to pass a -s argument followed by the simulator's display name in order to set the location of a single simulator, instead of all booted simulators.

    opened by keith 1
  • Reorder failure errors

    Reorder failure errors

    When there are no locations found for a query, MapKit returns a NSError instead of an empty array. This resulted in us printing a opaque error. Now we'll do that last, only if there is an error, but we also found a place.

    Here's an example of a query that currently fails:

    Lyft HQ San Francisco

    opened by keith 0
  • Not working on Github Actions CI

    Not working on Github Actions CI

    I'm trying to use set-simulator-location for testing behaviour on CI using Detox. It works fine when running locally, but does not work at all when running on Github Actions CI.

    Has anyone encountered this? Is it a known limitation or is there some build configuration that is necessary to enable location setting on CI servers?

    opened by cayleyh 8
  • A simple macOS app that allows you to specify starting/ending location for a route and send location updates based on real timing

    A simple macOS app that allows you to specify starting/ending location for a route and send location updates based on real timing

    Hi, first of all, thanks for open-sourcing this tool. It has saved me lots of time.

    I created a front-end for it so people can simulate dynamic trips. Demo is available here.

    Hope it helps.

    Billy.

    opened by billylo1 0
  • Feature request / suggestion: Using this to simulate track

    Feature request / suggestion: Using this to simulate track

    I made a small bash-script (with my very limited knowledge) to simulate a track based on a GEOjson object. Don't know if this belongs in this repo, but maybe it's relevant for others coming here:

    Track.json (uses all elements in coordinates):

    {
      "track": {
        "coordinates": [
          [10.762656440290426, 60.00290862625803],
          [10.762708634492366, 60.00293005616841],
          [10.762640254374531, 60.002963109255965],
          [10.762610401710422, 60.00300239554637]
        ]
      }
    }
    

    SimulateTrack.sh (also requires jq)

    #!/bin/bash
    
    # Pass interval as parameter
    interval=$1
    
    for k in $(jq '.track.coordinates | keys | .[]' Track.json); do
      lon=$(jq -r ".track.coordinates[$k][0]" Track.json);
      lat=$(jq -r ".track.coordinates[$k][1]" Track.json);
      set-simulator-location -c $lat $lon
      sleep "$interval"
    done
    

    Usage: Update location every second: ./SimulateTrip.sh 1

    Update location every 5 seconds:
    ./SimulateTrip.sh 5

    opened by haavardb 3
  • Feature request: Unset location?

    Feature request: Unset location?

    Thanks for the fantastic tool, it made my workflow a lot easier! 💯

    I'm working on an app that uses location a lot, but I also need to support cases where location is turned off, or where it fails for some reason.

    Would it be possible to extend the CLI to support unset/delete the location? set-simulator-location -d or something?

    opened by cbrevik 1
Releases(1.5.0)
Owner
Mobile Native Foundation
Mobile Native Foundation
🛰 CoreLocation Made Easy - Efficient & Easy Location Tracker, IP Location, Gecoder, Geofence, Autocomplete, Beacon Ranging, Broadcaster and Visits Monitoring

Location Manager Made Easy SwiftLocation is a lightweight Swift Library that provides an easy way to work with location-related functionalities. No mo

Daniele Margutti 3.2k Dec 30, 2022
The most power-efficient and lightweight iOS location manager for Swift and ObjC

IngeoSDK for iOS Overview IngeoSDK is a power-efficient location manager for iOS (Swift and Objective-C), which extends and improves CoreLocation. It

IngeoSDK 99 Feb 28, 2022
Easily get the device's current location on iOS.

INTULocationManager makes it easy to get the device's current location and is currently heading on iOS. It is an Objective-C library that also works g

Intuit 2.6k Dec 21, 2022
Application that displays current weather at a random location. iOS 14.0 or newer. SwiftUI.

Elseweather App that displays current weather at a random location. Description Elseweather was created as a student/research project with no practica

Ярослав 11 Dec 15, 2022
An iOS app to display quarantine classification information based on users location

ph covid19 Quarantine Classification Automatically check quarantine classification based on your location Tech: MVVM Observer Binding MapKit, CoreLoca

Carlos Rivas 0 Nov 15, 2021
A ready for use and fully customizable location picker for your app

LocationPicker A ready for use and fully customizable location picker for your app. Features Installation Cocoapods Carthage Swift Package Manager Qui

Zhuoran 397 Nov 16, 2022
Enumerate Location Services using CoreLocation API on macOS

SwiftLiverpool Description This tool leverages the CoreLocation API on macOS to enumerate Location Services data. You need to enable "Location Service

Justin Bui 4 Aug 20, 2022
Location Weather Demo With Swift

LocationWeatherDemo Здравствуйте! Для того что бы проект корректно работал установите pod's. О проекте: 1) На первой странице можно увидеть погоду в л

German Khodyrev 0 Dec 8, 2021
Simulate GPS location system-wide

locsim A tool to simulate GPS location system-wide. This tool simulates GPS location natively without any runtime injection, and it's how Apple do it.

udevs 47 Dec 29, 2022
A simple map with the location of the user and the control of permissions

Proposal The project is based on implementing a simple map with the location of

Raúl Pedraza León 0 Dec 26, 2021
Shows the ISS live location.

ISSLive Shows the ISS live location. Challenge tasks: Project structure Create repo. Setup project. Organize files following the MVVM pattern. Install

Alejandro Trejo Flores 0 Feb 2, 2022
An original project making use of custom UITableViewCells, date formatting, json parsing, and handling user location.

SunTimes An original project making use of custom UITableViewCells, date formatting, json parsing, date and time formatting based on the json data, an

David Chester 0 Feb 8, 2022
iOS and  Watch app to find city bicycles to rent in your city

Bike-Compass Bike Compass is a full-featured city bicycle finder app for iOS. Using a bike is enjoyable, that is why our app is fast, beautiful, and d

Raul Riera 80 May 18, 2022
Open-source iOS application written to explore Swift in its early days

Cepp iOS application written in Swift. Icon by: Rodrigo Nascimento (tks :D) IMPORTANT: *This project uses CocoaPods as the dependency manager, make su

Filipe Alvarenga 14 Sep 12, 2022
Contains the swift rewrite of Find My Bus NJ iOS App

FIND MY BUS NJ 2 An app for tracking NJ Transit bus times. Dependancies Alamofire SwiftyJSON PKHUD Fabric Getting started Install fastlane and imagema

null 44 Dec 10, 2022
A native iOS client to map the Pokemon around you!

Pokemap client for iOS This is a client for the Pokemap server (https://github.com/RocketMap/RocketMap) iPokeGO is now officially available on the App

Dimitri Dessus 640 Oct 12, 2022
🗺️ MAPS.ME — Offline OpenStreetMap maps for iOS and Android

MAPS.ME MAPS.ME is an open source cross-platform offline maps application, built on top of crowd-sourced OpenStreetMap data. It was publicly released

MAPS.ME 4.5k Dec 23, 2022
iOS app which uses the Moves API to visualize which places you spent the most time at in the last seven days.

Places Places uses the Moves API to visualize which places you spent the most time at in the last seven days. It runs on iOS 7 only and you need to ob

Boris Bügling 43 Feb 9, 2022
Neverlate is a self-improvement iOS app for people who are often late.

Neverlate Team: Ayuna Vogel, Charles Kang, Eric Sze. Neverlate is a self-improvement iOS app for people who are often late. Put money at stake and pic

Ayuna Vogel 28 Nov 1, 2022