1. 查看模拟器的命令
在 iOS 开发中,使用 Xcode 自带的 xcrun 和 xcodebuild 命令可以查看和运行 iOS 模拟器设备。以下是相关命令:
1. 查看可用的模拟器设备
xcrun simctl list devices或者:
xcrun simctl list这将列出所有可用的 iOS 模拟器设备,包括它们的 UDID(唯一标识符)和当前状态(Booted 代表正在运行)。
2. 启动指定的模拟器
xcrun simctl boot "iPhone 15 Pro"如果你知道 UDID,可以这样:
xcrun simctl boot <设备UDID>3. 运行 iOS 模拟器
如果模拟器未启动,可以使用:
open -a Simulator或者:
xcrun simctl boot "iPhone 15 Pro" && open -a Simulator4. 直接运行 App 到模拟器
如果你想把 app 运行到模拟器上,可以使用:
示例:
5. 关闭模拟器
或者关闭指定设备:
Last updated