iPhone模拟器无法启动?

发布于 2024-12-12 14:05:12 字数 192 浏览 0 评论 0原文

当我在 Xcode 上按“运行”且其他任务已在运行时,会显示以下消息:

正在使用模拟器。 模拟器无法启动,因为它已在使用中。

我和一些朋友核实过,当他们按下运行键时,Xcode 会自动停止正在运行的任务并运行你想要的应用程序。我在这里该如何配置?

提前致谢,

When I press Run on Xcode with other tasks already running, the following message appears:

Simulator in Use.
The Simulator can't be launched because it is already in use.

I checked with some friends and when they press run, Xcode automatically stop the tasks running and run the app you want. How can I configure this here?

Thanks in advance,

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

迟月 2024-12-19 14:05:13

我也遇到过这个问题,但对我来说这个问题与 XCode 或 Simulator 无关。

问题出在我的代码中。一个进程使 CPU 以 100% 运行,修复我的代码中的错误修复了模拟器问题。

I've been having this issue as well, but for me the problem doesn't have to do with XCode or Simulator.

The problem was in my code. A process was making the CPU run at 100%, and fixing the bug in my code fixed the simulator problem.

飞烟轻若梦 2024-12-19 14:05:13

强制退出、iOS Simulator 和 Xcode,然后重新打开 Xcode 并运行项目。

Force Quit both, iOS Simulator and Xcode, then reopen Xcode and run project.

走过海棠暮 2024-12-19 14:05:13

两种可能性。
1)退出模拟器,然后运行你想运行的应用程序
2)只需停止使用模拟器的应用程序并运行您想要运行的应用程序

Two Possibilities.
1)just quit the simulator,and run the application you want to run
2)just stop the application that using the simulator and run the application you want to run

骄傲 2024-12-19 14:05:13

按照问题持续存在的升序顺序尝试以下步骤:

  1. 退出模拟器。
  2. 清理项目,重置模拟器,删除“派生数据”。
  3. 如果不起作用,请从 Mac 菜单中强制退出 Xcode 和模拟器。

强制退出 Xcode 似乎总是对我有用。

这确实是一个棘手的 Xcode bug。现在问题已经解决了,编码愉快!

Try these steps in increasing order of persistence of the problem:

  1. Quit the Simulator.
  2. Clean the project, Reset Simulator, Delete 'Derived Data'.
  3. If nothing works, Force Quit Xcode and Simulator from the Mac Menu.

Force Quitting Xcode seems to always work for me.

It was one sticky Xcode bug indeed. Now it's solved, happy coding!

无声静候 2024-12-19 14:05:12

退出模拟器并重试。如果不起作用,请退出 Xcode 并重试。

Quit the simulator and try again. if not working quit the Xcode and try again.

咽泪装欢 2024-12-19 14:05:12

如果您在 Xcode 中打开两个项目并且其中一个正在模拟器上运行,则您无法运行另一个。浏览每个项目窗口,查看是否有正在运行的项目,如果正在运行,请按左上角的“停止”按钮:

在此输入图像描述

If you have two projects open in Xcode and one is running on the simulator, you can't run the other. Go through each project window and see if any are running, and if they are, press the "Stop" button on the top left:

enter image description here

往事风中埋 2024-12-19 14:05:12

在大多数情况下,Josh 的回答可以解决这个问题。但现在碰巧我在 Xcode 中只有一个项目,并且尝试清理和构建它却没有任何效果。
对我来说(这次)的解决方案是:

  1. 右键单击扩展坞中的模拟器,然后单击“退出”。
  2. 我对 Xcode 做了同样的事情(右键单击 Dock 中的 Xcode,然后单击“退出”)。
  3. 之后,只需重新打开 Xcode,瞧!

有用!!!

In most cases Josh answer solves this problem. But just now happened to me to have only one project in Xcode and trying to clean and built it did nothing.
For me (this time) the solution was to:

  1. Right click the simulator from dock and click Quit.
  2. I did the same for Xcode (right click on Xcode in Dock and clicked Quit).
  3. After that just re-open Xcode and voila!

It works!!!

以为你会在 2024-12-19 14:05:12

如果问题是您打开了多个项目并遇到模拟器冲突,有人创建了一个小 Automator 脚本来关闭当前模拟器并启动下一个模拟器。一种解决办法,但可能对你有用。

在此处查看详细答案。

If the issue is you have multiple projects open and running into Simulator conflicts, someone created a little Automator script that closes the current simulator and starts the next one. Kind of a work around but might work for you.

Check out the detailed answer here.

叹倦 2024-12-19 14:05:12

过度附加调试器综合症

当我切换模拟器类型(ios 版本或设备类型)而不按停止按钮(应用程序仍在其上运行)时,就会发生这种情况。要解决此问题,请切换回旧版本(如果您还记得它是:P),运行然后停止应用程序,切换到所需的模拟器配置,运行,tadaaaa:错误消失了。

如果您有两个项目并且其中一个正在运行,并且您尝试运行另一个项目,也可能会发生这种情况。解决方案是在启动所需的一项之前停止另一项。

如果您遇到某种疯狂的错误并且模拟器没有响应,这种情况也会发生,在这种情况下,调试器仍然处于连接状态,为它心爱的模拟器哭泣。您必须关闭 xcode 模拟器,有时还需要重新启动。

我此时已经有了最新的 xcode 版本,并且有一段时间感到沮丧。现在我不用重新启动模拟器、xcode、计算机、路由器,去睡觉并第二天早上醒来... :D

希望这对你们有帮助,苹果在 xcode 中有很多奇怪的未分类异常。他们至少可以说调试器仍然附加在内存中的某些东西,我们是程序员而不是普通用户,你给我们的错误越多,我们就越了解如何避免它们。

我个人最喜欢的si是当xcode将绝对路径添加到你新添加的名作时,你会疯狂地试图找出为什么它在其他计算机上不起作用(仙境综合症中的项目)。

(还有咆哮咆哮咆哮讽刺咆哮......你明白了)

The over attached debugger syndrome

This happens to me when I switch simulator type (ios version or device type) without pressing the stop button (application was still running on it). To fix this, switch back to the old one (if you remember witch it was :P), run then stop the application, switch to the desired simulator configuration, run, tadaaaa: the error is gone.

This can also happen if you have two projects and one is running, and you try to run the other one. The solution is to stop the other one before starting the desired one.

This ca also happen if you had some kind of crazy bug and the simulator is unresponsive, in this case the debugger remains attached, crying over it's beloved simulator. You have to close the xcode simulator and sometimes restart for this one.

I have the latest xcode version at this time and got fustrated for a while. Now I'm free from restarting the simulator, xcode, coputer, router, going to sleep and waking up the next morning... :D

Hope this helps you guys apple has a lot of weird unclassified exceptions in xcode. They could least say that the debugger is still atached to something in the memory, we are programers not ordinary users, the more errors you give us the better we understand how to avoid them.

My personal favorite si when xcode puts absolute paths to your newly added famework that go nuts triing to find out why it doesn't work on an other computer (The project in wonderland syndrome).

(and rant rant rant irony rant.. you get the idea)

三生一梦 2024-12-19 14:05:12

退出 xcode 和模拟器,然后尝试重新启动你的 mac

Quit the xcode and simulator ,and try to restart your mac

草莓味的萝莉 2024-12-19 14:05:12

退出模拟器并重试。

Quit the simulator and try again.

忆沫 2024-12-19 14:05:12

您的 Mac 可能会自动打开 iPhone 模拟器,为了停止这种情况,您可以通过导航到 ~/Applications/Terminal.app 运行终端(OSX 版本的命令提示符)
从那里您可以运行这些命令。

  1. top -u 此命令显示 mac 的进程以及有关它们的一些信息,从那里您可以查看 iPhone Simulator 是否已打开。
  2. sudo Killall iPhone\ Simulator 为您解构此命令,sudo 让您输入登录密码,killall 使您进入超级用户模式:命令杀死指定名称的所有进程。 iPhone\ Simulator:这是应用程序的名称,为了有一个空格,需要在第二个单词之前添加 \(空格)。通过运行此命令,您将终止所有名为 iPhone Simulator 的进程。
  3. 如果这没有帮助,请尝试重新启动
  4. 如果重新启动没有帮助,请尝试重新安装 XCode
  5. 如果重新安装XCode没有帮助,请尝试重新安装您的操作系统

祝你好运!

Your mac might be opening iPhone Simulator automatically, In order to stop this you can run Terminal, OSX's version of command prompt, by navigating to ~/Applications/Terminal.app
from there you can run these commands.

  1. top -u This command shows the mac's processes, and some information about them, from there you can see whether iPhone Simulator might be open.
  2. sudo killall iPhone\ Simulator Deconstructing this command for you, sudo puts you into superuser mode, by having you enter your login password, killall : This command kills all processes by the name specified. iPhone\ Simulator: This being the name of the app, and in order to have a space requires the \ (space) before the second word. By running this command you will kill all processes called iPhone Simulator.
  3. If this doesn't help, then try rebooting.
  4. If rebooting doesn't help try re-installing XCode.
  5. If re-installing XCode doesn't help, then try re-installing your Operating System entirely.

Good Luck!

少女情怀诗 2024-12-19 14:05:12

此问题有三种解决方案:

  1. 右键单击​​ Doc 上的模拟器,退出,然后从 Xcode 重新运行应用程序。

如果这不起作用,那么 -

  1. 保存您的代码,右键单击 Xcode,使用您的项目重新启动 Xcode,然后再次运行。请记住在目标中选择模拟器而不是设备。

如果这也不起作用,那么,

  1. 强制关闭 - 模拟器/Xcode - 重新启动你的 Mac,然后再次运行 Xcode。

最有可能的是——第一步就足够了!

There are three solutions for this issue:

  1. Right click the simulator on the Doc, quit and then re-run the application from the Xcode.

If this did not work, then -

  1. Save your code, Right click the Xcode, restart the Xcode with your project and then run again. Remember to select simulator instead of device in the target.

If this also did not work, then,

  1. Force Close - Simulator/Xcode - Restart your mac and then run Xcode again.

Most likely - the first step would be enough!!!

七色彩虹 2024-12-19 14:05:12

要让模拟器停止正在运行的任何内容,您需要选中“不再显示此消息”框。

示例:

在此处输入图像描述

然后单击该框。

在此处输入图像描述

然后,即使程序已经在运行,您也可以运行模拟器。

To get the simulator to stop whatever is running you need to check off the box "Do not show this message again".

Example:

enter image description here

And then click the box.

enter image description here

And then you can run the simulator even if a program had already been running.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文