iOS 查看设备列表(包括模拟器)

How to list devices available to Xcode

原文

Using xcodebuild, or better xcrun xcodebuild we can do things such as running tests from the terminal.

xcrun xcodebuild \
-workspace "Coconut.workspace" \
-scheme "Coconut" \
-sdk iphonesimulator \
-destination 'platform=iOS Simulator,name=iPhone 6,OS=8.1' \
test

But what to write in the -destination parameter? How do we know the available devices that can be used as parameter?

The instruments cli tool from Apple has an answer to that.

instrumenst “runs an Instrument template from the command line”, and one of the available options to pass is is -s devices, to “show list of known devices, and then exit”.

instruments -s devices

Known Devices:
Gio’s MacBook Pro []
Gio's iPhone 6 (8.2) []
Resizable iPad (8.2 Simulator) []
Resizable iPhone (8.2 Simulator) []
iPad 2 (8.2 Simulator) []
iPad Air (8.2 Simulator) []
iPad Retina (8.2 Simulator) []
iPhone 4s (8.2 Simulator) []
iPhone 5 (8.2 Simulator) []
iPhone 5s (8.2 Simulator) []
iPhone 6 (8.2 Simulator) []
iPhone 6 Plus (8.2 Simulator) []

There you go, here’s the list of known devices to the computer, and any of can be used as the parameters for the -destination argument.

查看正在运行的模拟器的udid: xcrun simctl list devices | grep Booted

启动某个模拟器上的某个应用:xcrun simctl launch 319ADEF3-E9E9-434C-B520-B4E781DB2731 com.***.iphoneclientdev

你可能感兴趣的:(iOS 查看设备列表(包括模拟器))