iPhone模拟器无法启动?
当我在 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(14)
我也遇到过这个问题,但对我来说这个问题与 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.
强制退出、iOS Simulator 和 Xcode,然后重新打开 Xcode 并运行项目。
Force Quit both, iOS Simulator and Xcode, then reopen Xcode and run project.
两种可能性。
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
按照问题持续存在的升序顺序尝试以下步骤:
强制退出 Xcode 似乎总是对我有用。
这确实是一个棘手的 Xcode bug。现在问题已经解决了,编码愉快!
Try these steps in increasing order of persistence of the problem:
Force Quitting Xcode seems to always work for me.
It was one sticky Xcode bug indeed. Now it's solved, happy coding!
退出模拟器并重试。如果不起作用,请退出 Xcode 并重试。
Quit the simulator and try again. if not working quit the Xcode and try again.
如果您在 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:
在大多数情况下,Josh 的回答可以解决这个问题。但现在碰巧我在 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:
It works!!!
如果问题是您打开了多个项目并遇到模拟器冲突,有人创建了一个小 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.
过度附加调试器综合症
当我切换模拟器类型(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)
退出 xcode 和模拟器,然后尝试重新启动你的 mac
Quit the xcode and simulator ,and try to restart your mac
退出模拟器并重试。
Quit the simulator and try again.
您的 Mac 可能会自动打开 iPhone 模拟器,为了停止这种情况,您可以通过导航到
~/Applications/Terminal.app
运行终端(OSX 版本的命令提示符)从那里您可以运行这些命令。
top -u
此命令显示 mac 的进程以及有关它们的一些信息,从那里您可以查看 iPhone Simulator 是否已打开。sudo Killall iPhone\ Simulator
为您解构此命令,sudo
让您输入登录密码,killall
使您进入超级用户模式:命令杀死指定名称的所有进程。iPhone\ Simulator
:这是应用程序的名称,为了有一个空格,需要在第二个单词之前添加\(空格)
。通过运行此命令,您将终止所有名为 iPhone Simulator 的进程。祝你好运!
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.
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.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.Good Luck!
此问题有三种解决方案:
如果这不起作用,那么 -
如果这也不起作用,那么,
最有可能的是——第一步就足够了!
There are three solutions for this issue:
If this did not work, then -
If this also did not work, then,
Most likely - the first step would be enough!!!
要让模拟器停止正在运行的任何内容,您需要选中“不再显示此消息”框。
示例:
然后单击该框。
然后,即使程序已经在运行,您也可以运行模拟器。
To get the simulator to stop whatever is running you need to check off the box "Do not show this message again".
Example:
And then click the box.
And then you can run the simulator even if a program had already been running.