Xcode 6 - 从命令行启动模拟器 [英] Xcode 6 - Launch simulator from command line
问题描述
我想从命令行启动iPhone模拟器。
I want to launch iPhone simulator from command line.
直到现在我一直在使用以下命令
until now I have been using the below command
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator -SimulateDevice
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app/Contents/MacOS/iPhone Simulator -SimulateDevice
-SimulateDevice用于启动特定设备类型
-SimulateDevice is used to launch a specific device type
现在使用Xcode 6路径和应用程序已改为
Now with Xcode 6 the path and the app has been changed to
/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app/Contents/MacOS/iOS模拟器
/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app/Contents/MacOS/iOS Simulator
但遗憾的是-SimulateDevice选项现在不能正常工作。我可以启动模拟器,但是没有选项来指定要启动的模拟器
but sadly -SimulateDevice option is not working now. I can launch the simulator, but dont have an option to specify which one to launch
有人用Xcode 6找到了任何替代品吗?
Anyone found any alternatives for this with Xcode 6?
推荐答案
找到了实现我想要的方法。
Found a way to achieve what I wanted.
Apple用Xcode 6推出了一个有趣的工具!
Apple has introduced an interesting tool with Xcode 6!
simctl
simclt允许您控制正在运行的模拟器。
simclt allows you to control the simulator that are running.
运行 xcrun simctl
获取列表可用的子命令。有很多新的选择可供使用。
run xcrun simctl
to get the list of available subcommands. Lots of new options to play around with.
现在做我想做的事,这是启动模拟器的命令:
Now to do what I wanted, here is the command to launch the simulator:
xcrun instruments -wiPhone 5(8.0模拟器)
-w是提供的设备类型并获取可用设备列表。
-w is to provide a device type and to get the list of available devices.
执行此操作:
xcrun instruments -s
启动模拟器后,您可以使用 simctl
After launching the simulator you can control it using simctl
安装你的应用程序:
xcrun simctl install booted< app path> ;
启动应用程序:
xcrun simctl launch booted< app identifier>
希望这会有所帮助。
这篇关于Xcode 6 - 从命令行启动模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!