Xcode 6 - 从命令行启动模拟器 [英] Xcode 6 - Launch simulator from command line

查看:30
本文介绍了Xcode 6 - 从命令行启动模拟器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从命令行启动 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 Simulator

/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 instrument -w "iPhone 5 (8.0 Simulator)"

-w 用于提供设备类型并获取可用设备列表.

-w is to provide a device type and to get the list of available devices.

只要执行这个:

xcrun 工具 -s

启动模拟器后,您可以使用 simctl

After launching the simulator you can control it using simctl

要安装您的应用:

xcrun simctl install booted

启动应用程序:

xcrun simctl launch booted

希望这会有所帮助.

这篇关于Xcode 6 - 从命令行启动模拟器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆