Xcode 6 - 从命令行启动模拟器

2023-12-02

我想从命令行启动 iPhone 模拟器。

到目前为止我一直在使用下面的命令

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator -SimulateDevice

-SimulateDevice 用于启动特定的设备类型

现在,在 Xcode 6 中,路径和应用程序已更改为

/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app/Contents/MacOS/iOS Simulator

但遗憾的是 -SimulateDevice 选项现在不起作用。我可以启动模拟器,但没有选项来指定要启动哪个模拟器

有人找到了 Xcode 6 的替代方案吗?


找到了实现我想要的目标的方法。

Apple 在 Xcode 6 中引入了一个有趣的工具!

simctl

simclt 允许您控制正在运行的模拟器。

run xcrun simctl获取可用子命令的列表。有很多新的选项可供使用。

现在要做我想做的事,下面是启动模拟器的命令:

xcrun instruments -w "iPhone 5 (8.0 Simulator)"

-w 是提供设备类型并获取可用设备的列表。

只需执行这个:

xcrun instruments -s

启动模拟器后,您可以使用它来控制它simctl

要安装您的应用程序:

xcrun simctl install booted <app path>

启动应用程序:

xcrun simctl launch booted <app identifier>

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Xcode 6 - 从命令行启动模拟器 的相关文章

随机推荐