问题
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,
回答1:
Quit the simulator and try again. if not working quit the Xcode and try again.
回答2:
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:

回答3:
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:
- Right click the simulator from dock and click Quit.
- I did the same for Xcode (right click on Xcode in Dock and clicked Quit).
- After that just re-open Xcode and voila!
It works!!!
回答4:
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.
回答5:
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)
回答6:
Quit the xcode and simulator ,and try to restart your mac
回答7:
Quit the simulator and try again.
回答8:
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.- If this doesn't help, then try rebooting.
- If rebooting doesn't help try re-installing XCode.
- If re-installing XCode doesn't help, then try re-installing your Operating System entirely.
Good Luck!
回答9:
There are three solutions for this issue:
- Right click the simulator on the Doc, quit and then re-run the application from the Xcode.
If this did not work, then -
- 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,
- Force Close - Simulator/Xcode - Restart your mac and then run Xcode again.
Most likely - the first step would be enough!!!
回答10:
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.
回答11:
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.
回答12:
Force Quit both, iOS Simulator and Xcode, then reopen Xcode and run project.
回答13:
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
回答14:
Try these steps in increasing order of persistence of the problem:
- Quit the Simulator.
- Clean the project, Reset Simulator, Delete 'Derived Data'.
- 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!
来源:https://stackoverflow.com/questions/7947710/iphone-simulator-cant-be-lauched