问题
I was working on an iOS app in xCode and I was perfectly using the simulator. Yesterday I had to create a new project and after putting some code I found out that when clicking Run, the app compiles, links, but then the simulator never starts. And stop is disabled. I tried with both iOS sim on and off. Opening the old project back shows the simulator but after switching to the new one, nothing happens. Any ideas on how to fix this? I am using a Single-View app.
回答1:
We switch between apps all the time in Xcode, and you're not crazy - it's definitely fickle (which seems ridiculous). Try this:
- Clean (
⌘ + shift + k
) - Restart Xcode
...if that doesn't work, we've also had to clean out the local caches à la ⌘ + option + shift + k
or even deeper, as described in this answer.
Hopefully those will help!
回答2:
- Clean the Xcode project.
- Select the Simulator and do "Reset Contents and Settings"
- Shut down Xcode and Simulator.
- Restart Xcode and run your app.
(And sometimes, if you use Activity Monitor, you will find a Simulator process still running when it's supposed to be shut down. Kill that with Activity Monitor and restart everything.)
(Also, although the theory is that it can't happen, sometimes the Mac runs out of available thread handles. Then you need to reboot the Mac.)
回答3:
The problem has been fixed eventually.
Near the Run, Stop buttons, click the app name, for example Demo and then click Edit Scheme.
Now click Info and then set the Executable to your app executable, usually in the only subfolder of the default location. Click Okay and feel free to run the simulator. It will now work just as well.
回答4:
Seems like an odd issue to have. I'd close Xcode and the iOS Simulator completely and try again. Worst case would be to reboot system. Shouldn't be any reason a new project wouldn't run.
来源:https://stackoverflow.com/questions/16840113/xcode-ios-simulator-does-not-load-new-project