我想从命令行启动iPhone模拟器。
到目前为止,我一直在使用下面的命令
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone模拟器.app/Contents/MacOS/模拟器-SimulateDevice
-SimulateDevice用于启动特定的设备类型
现在,在Xcode6中,路径和应用程序已更改为
/Applications/Xcode.app/Contents/Developer/Applications/iOS模拟器.app/Contents/MacOS/iOS模拟器
但遗憾的是,-SimulateDevice选项现在不起作用了。我可以启动模拟器,但没有指定启动哪个模拟器的选项
有没有人在Xcode6中找到了替代方案?
发布于 2014-09-25 15:14:38
找到了一种方法来实现我想要的。
Apple在Xcode6中引入了一个有趣的工具!
simctl
simclt允许你控制正在运行的模拟器。
运行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>
希望这能有所帮助。
发布于 2014-09-26 14:02:01
在Xcode6中,如果您想让iOS Simulator.app在启动时引导特定的设备,您可以从命令行运行以下命令:
open -a "iOS Simulator" --args -CurrentDeviceUDID <DEVICE UDID>
在这里,您可以确定要从中引导的设备的UDID:
xcrun simctl list
在Xcode7中,应用程序被重命名为Simulator.app,因此您应该相应地更新上面的代码:
open -a Simulator --args -CurrentDeviceUDID <DEVICE UDID>
发布于 2015-09-19 04:20:40
对于xcode 7:
open /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app --args -CurrentDeviceUDID <DeviceUDID>
从xcrun simctl list
获取模拟器udid
https://stackoverflow.com/questions/26031601
复制相似问题