Xcode 6 - Launch simulator from command line

前端 未结 8 1111
执念已碎
执念已碎 2020-11-28 00:20

I want to launch iPhone simulator from command line.

until now I have been using the below command

/Applications/Xcode.app/Contents/Developer

相关标签:
8条回答
  • 2020-11-28 01:22

    Run this command. The app will be restarted followed by changes. No need to rebuild it again.

    ios-sim "launch" "/Library/WebServer/Documents/testapp/build/iphone/build/Debug-iphonesimulator/test.app" "--devicetypeid" "iPad-2" "--exit";
    

    For devicetypeid list:

    ios-sim showdevicetypes
    
    0 讨论(0)
  • 2020-11-28 01:24

    Verified in Xcode 9.4.1

    Device list in a REALLY NICE FORMAT: ~/Library/Developer/CoreSimulator/Devices/device_set.plist

    Root
        DefaultDevices
            com.apple.CoreSimulator.SimRuntime.iOS-8-4
                 com.apple.CoreSimulator.SimDeviceType.iPad-Retina : AB335FAF-E3E3-4AE9-A0AF-D1C6AEB5FBD4
    

    Then you want to run (open) your Simulator app and make sure that a new instance of the app is launched.

    The app is here: /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app

    And the format you'd use is like this:

    open -n -a <SimulatorPath> --args -CurrentDeviceUDID <SimDeviceTypeUDID>

    So, if I wanted to launch the Simulator above, I'd do this.

    open -n -a /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID AB335FAF-E3E3-4AE9-A0AF-D1C6AEB5FBD4

    Hot damn! I just tested it and it works on Mac OS 10.11.6. Now the next trick is telling the Simulator to open our installed app. I'm not there yet. Hope this helps. Thanks to https://stackoverflow.com/users/726106/jeremy-huddleston-sequoia for his detailed explanation.

    0 讨论(0)
提交回复
热议问题