xcode 我可以在没有“Build and Run”的情况下启动 iPhone 模拟器吗?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5048524/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 03:42:51  来源:igfitidea点击:

Can I start the iPhone simulator without "Build and Run"?

xcodeios-simulator

提问by RobertL

I want to delete an app in the simulator before I "build and run". How can I start the simulator so I can do the deletion? If I start it by "build and run" I get a long log output that takes a while because of a bug I'm trying to fix. I'd like to avoid that.

我想在“构建和运行”之前删除模拟器中的应用程序。如何启动模拟器以便进行删除?如果我通过“构建并运行”启动它,我会得到一个很长的日志输出,由于我试图修复的错误,它需要一段时间。我想避免这种情况。

回答by Seth

The simulator is just an application, and as such you can run it like any other application.

模拟器只是一个应用程序,因此您可以像运行任何其他应用程序一样运行它。

To run the simulator straight from terminal prepend these locations with the opencommand

要直接从终端运行模拟器,请在这些位置前面加上open命令

Xcode 7.x, 8.x, and 9.x

Xcode 7.x、8.x 和 9.x

In Xcode 7.x, the iPhone Simulator has moved again: /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app.

在 Xcode 7.x 中,iPhone 模拟器再次移动:/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app.

Xcode 6.x

Xcode 6.x

In Xcode 6.x, the iPhone Simulator has moved yet again, and now resides here: /Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app.

在 Xcode 6.x 中,iPhone 模拟器再次移动,现在位于:/Applications/Xcode.app/Contents/Developer/Applications/iOS Simulator.app.



Xcode 4.x, 5.x

Xcode 4.x、5.x

In Xcode 4.x (through 4.5 on Mountain Lion) and Xcode 5.0.x on Mavericks, it lives here: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/

在 Xcode 4.x(Mountain Lion 上的 4.5)和 Mavericks 上的 Xcode 5.0.x 中,它位于此处: /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/

In my version of Xcode (4.5.2), I find it quite convenient to use the Open Developer Toolmenu from either the dock icon or the Xcode menu:

在我的 Xcode (4.5.2) 版本中,我发现使用Open Developer Tool停靠栏图标或 Xcode 菜单中的菜单非常方便:

open iOS Simulator

打开 iOS 模拟器



Xcode 3.x

Xcode 3.x

In Xcode 3.x, it lives here:

在 Xcode 3.x 中,它位于:

/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app

/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app



In some future version of Xcode, it will probably move again, it's a squirrelly little app.

在 Xcode 的某个未来版本中,它可能会再次移动,它是一个松鼠般的小应用程序。

回答by atreat

From Terminal you can use:

从终端您可以使用:

open -a iPhone\ Simulator
open -a iOS\ Simulator
open -a Simulator

This all depends on the application name of the simulator, this can change with each iteration of Xcode.

这一切都取决于模拟器的应用程序名称,这可以随着 Xcode 的每次迭代而改变。

回答by inta

Since XCode 4.3 the location has changed, the simulator can now be found at:

由于 XCode 4.3 位置已更改,现在可以在以下位置找到模拟器:

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/

回答by user1450909

To follow up on that the new command from @jimbojw to create a shortcut with the new Xcode (installing through preferences) is:

要跟进来自@jimbojw 的新命令,以使用新的 Xcode 创建快捷方式(通过首选项安装)是:

ln -s /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app /Applications/iPhone\ Simulator.app

Which will create a shortcut in the applications folder for you.

这将为您在应用程序文件夹中创建一个快捷方式。

回答by Jaybo

Use Spotlight.

使用聚光灯

But only the last simulator will be opened. If you used iPad Air 2last time, Spotlight will open it. If you wanna open iPhone 6sthis time, that's a problem.

但只会打开最后一个模拟器。如果您iPad Air 2上次使用过,Spotlight 将打开它。如果你iPhone 6s这次要打开,那是个问题。

回答by jimbo

First, add the iOS Simulator to Applications:

首先,将 iOS 模拟器添加到应用程序:

ln -s /Developer/Platforms/iPhoneSimulator.platform/Developer/Applications/iPhone\ Simulator.app /Applications/iPhone\ Simulator.app

From there you can open it in Finder or drag it to the launch bar.

从那里您可以在 Finder 中打开它或将其拖到启动栏中。

Source: http://www.bram.us/2010/05/05/xcode-iphone-simulator-location/

来源:http: //www.bram.us/2010/05/05/xcode-iphone-simulator-location/

回答by delliottg

This is an older question, but if you simply want to run the simulator from the Xcode 4.5 UI, you can do: Xcode > Open Developer Tool > iOS Simulator.

这是一个较旧的问题,但如果您只是想从 Xcode 4.5 UI 运行模拟器,您可以这样做:Xcode > Open Developer Tool > iOS Simulator。

回答by bolinfest

Without opening Xcode:

不打开Xcode:

open /Applications/Xcode.app/Contents/Developer/Applications/iOS\ Simulator.app/

回答by Thai Tran

The easiest way is start the simulator from the Xcode, and then on the dock, Ctrl+ Clickon the icon and select Keep in Dockenter image description here

最简单的方法是从 启动模拟器Xcode,然后在 Dock上,图标上的Ctrl+Click并选择Keep in Dock在此处输入图片说明

回答by Dheeraj Gupta

For Xcode 7.2

对于 Xcode 7.2

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

打开/Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/Contents/MacOS/Simulator.app

sudo ./Simulator

须藤./模拟器

And adding this path in your profile is the best way.

在您的个人资料中添加此路径是最好的方法。