使用模拟器进行多个项目 [英] Multiple projects using the simulator

查看:97
本文介绍了使用模拟器进行多个项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在比较使用Xcode模拟器的多个项目的运行情况.每次我运行完一个其他项目后再去构建一个项目时,Xcode都会告诉我,由于使用了模拟器,它无法执行构建和运行.然后,我必须找到另一个项目窗口,在模拟器(Cmd-.)中停止运行,然后切换回上一个窗口并进行重建.我可以做一个键盘快捷键来停止在模拟器中的当前运行,在模拟器中生成并运行当前项目吗?

I am comparing the run of multiple projects using the Xcode simulator. Each time I go to build in one project after having run one of the other projects Xcode tells me that it cannot perform the build and run because the simulator is in use. I then have to find the other project window, stop the run in the simulator (Cmd-.) and then switch back to the previous window and rebuild. Can I make a single keyboard shortcut to stop the current run in the simulator, build and run the current project in the simulator?

推荐答案

要做到这一点需要做一些事情,但总的来说很容易.

There is a little bit of doing involved in making this happen but overall it's pretty easy.

您要做的第一件事是打开Automator.如果您以前从未使用过它,它会包含在您的Mac中,因此只需搜索一下即可.启动Automator时,系统将提示您创建一个新项目,选择服务".

The first thing you'll want to do is open Automator. Incase you've never used it before, it is included on your mac so just search it. When Automator launches, you will be prompted to create a new project, select "Service."

然后如下调整服务接收部分

Then adjust the service receives section as follows

在Automator的左侧,您将看到一个搜索窗格,搜索运行Applescript",然后将运行Applescript"的实例拖动到服务接收"部分下. 现在,您将要更改applescript以适合您的需求.在这种情况下,您将用告诉应用程序"iPhone Simulator"退出"来替换(*您的脚本在这里*)"

On the left side of Automator, you'll see a search pane, search for "Run Applescript" and then drag the instance of "Run Applescript" under your service receives section. Now you're going to want to change the applescript to suite your needs. In this case you'll replace "(* Your script goes here *)" with "tell application "iPhone Simulator" to quit"

更改完Applescript后,请将自动化保存为所需的名称,它将以该名称显示在服务"中.

Once you're done altering the Applescript, save the automation as whatever you'd like, it will show up in Services under this name.

现在,您将转到系统偏好设置"并搜索服务" 如您所见,我将服务命名为"Quit Simulator",然后选择要定义的快捷方式. (请不要与现有的快捷方式冲突!)

Now you're going to head over to "System Preferences" and search "services" As you can see, I named my Service "Quit Simulator" select yours and define whatever shortcut you want for it. (Try not to conflict with existing shortcuts!)

现在,如果遇到使用中的模拟器"错误,则可以退出模拟器,并通过简单的按键操作结束当前的所有过程.

And now if you encounter the "Simulator in use" error you can quit the simulator, ending any current process with a simple keystroke.

希望这会有所帮助!

这篇关于使用模拟器进行多个项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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