I am getting this error with Xcode7.
Xcode cannot launch apps on the simulated device “iPhone 5”,
as it is currently running app with pid 3626 on “iPhone 6s Plus”.
Only one simulated device may be used at a time
I am not running any other app but the simulator still shows the message above.
I restarted XCode but it still did not work.
There are no active processes running for iOS simulator in the activity monitor.
Close the simulator (cmd+Q) and retry.
Also, make sure that another Xcode project is not using it.
Restarting xcode worked for me.
Related
I am attempting to set up automated testing for my iOS app using TeamCity. Currently, my agent builds, but once building the last target and running codesign, it hangs and displays the following:
[19:29:34][CodeSign] CodeSign /var/root/Library/Developer/Xcode/DerivedData/MyProductiOS-fgkoogiimhlbckdlbckzmqfyaoff/Build/Products/Debug-iphonesimulator/MyProductiOSUITests-Runner.app/PlugIns/MyProductiOSUITests.xctest
[19:29:34][CodeSign] cd /Users/ericmiller/.tcagent/work/f9abef315a0137d4
[19:29:34][CodeSign] export CODESIGN_ALLOCATE=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/codesign_allocate
[19:29:34][CodeSign] export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/Users/ericmiller/.pyenv/shims:/Users/ericmiller/.rbenv/shims:/Users/ericmiller/.pyenv/shims:/Users/ericmiller/Scripts:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/opt/local/bin"
[19:29:34][CodeSign] Signing Identity: "-"
[19:29:34][CodeSign] /usr/bin/codesign --force --sign - --timestamp=none /var/root/Library/Developer/Xcode/DerivedData/MyProductiOS-fgkoogiimhlbckdlbckzmqfyaoff/Build/Products/Debug-iphonesimulator/MyProductiOSUITests-Runner.app/PlugIns/MyProductiOSUITests.xctest
[19:29:34][CodeSign] /var/root/Library/Developer/Xcode/DerivedData/MyProductiOS-fgkoogiimhlbckdlbckzmqfyaoff/Build/Products/Debug-iphonesimulator/MyProductiOSUITests-Runner.app/PlugIns/MyProductiOSUITests.xctest: replacing existing signature
[19:31:32][CodeSign] 2017-01-22 19:31:32.279 xcodebuild[28262:86807] iOSSimulator: Timed out waiting 120 seconds for simulator to boot, current state is 1.
[19:31:32][CodeSign] 2017-01-22 19:31:32.290 xcodebuild[28262:86805] iOSSimulator: Timed out waiting 120 seconds for simulator to boot, current state is 1.
[19:31:32][CodeSign] 2017-01-22 19:31:32.291 xcodebuild[28262:86797] Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Timed out waiting 120 seconds for simulator to boot, current state is 1. If you believe this error represents a bug, please attach the log file at /var/root/Library/Developer/Xcode/DerivedData/MyProductiOS-fgkoogiimhlbckdlbckzmqfyaoff/Logs/Test/89F7C786-9E91-419F-98CA-F36385618DC2/Session-MyProductiOSTests-2017-01-22_192932-E95vcV.log" UserInfo={NSLocalizedDescription=Timed out waiting 120 seconds for simulator to boot, current state is 1. If you believe this error represents a bug, please attach the log file at /var/root/Library/Developer/Xcode/DerivedData/MyProductiOS-fgkoogiimhlbckdlbckzmqfyaoff/Logs/Test/89F7C786-9E91-419F-98CA-F36385618DC2/Session-MyProductiOSTests-2017-01-22_192932-E95vcV.log}
[19:31:32][CodeSign] 2017-01-22 19:31:32.291 xcodebuild[28262:86797] Error Domain=IDETestOperationsObserverErrorDomain Code=3 "Timed out waiting 120 seconds for simulator to boot, current state is 1. If you believe this error represents a bug, please attach the log file at /var/root/Library/Developer/Xcode/DerivedData/MyProductiOS-fgkoogiimhlbckdlbckzmqfyaoff/Logs/Test/89F7C786-9E91-419F-98CA-F36385618DC2/Session-MyProductiOSUITests-2017-01-22_192932-mrX7wQ.log" UserInfo={NSLocalizedDescription=Timed out waiting 120 seconds for simulator to boot, current state is 1. If you believe this error represents a bug, please attach the log file at /var/root/Library/Developer/Xcode/DerivedData/MyProductiOS-fgkoogiimhlbckdlbckzmqfyaoff/Logs/Test/89F7C786-9E91-419F-98CA-F36385618DC2/Session-MyProductiOSUITests-2017-01-22_192932-mrX7wQ.log}
The simulator app is open in the dock. Clicking on the simulator does nothing, but if I right-click and select the window, I can see that the simulator is indeed running but is not displaying anything. Example
I'm looking for a workaround to test my code, without switching to a physical device instead of a simulator if possible. How can I achieve this goal, and what could be wrong with my configuration?
EDIT:
Sven Driemecker found the solution. Here's my configuration.
Before running the xcodebuild, I run the following shell script to ensure a sanitary testing environment.
xcrun simctl shutdown %env.simulator_guid%
killall Simulator
killall com.apple.CoreSimulator.CoreSimulatorService
xcrun simctl erase %env.simulator_guid%
Then, when running the xcodebuild, add the following option:
-destination "id=%env.simulator_guid%"
And finally, to clean everything up:
xcrun simctl shutdown %env.simulator_guid%
killall Simulator
killall com.apple.CoreSimulator.CoreSimulatorService
Update: Here's a blog post I wrote about how to set up basic TeamCity CI for XCode/iOS.
I have been experiencing a similar error when attempting to run an iOS app in the simulator from Xcode 11.3.1. I have found that re-choosing the virtual hardware can resolve this issue a little quicker than other solutions mentioned on this page.
When I receive the "Timed out waiting for Simulator.app to become ready" error in Xcode, the Simulator.app has typically launched but shows no actual simulator. Choosing Hardware > Device > [OS version] -> [Simulator Name] causes the simulator to appear and successfully launch my app on the next run attempt.
It seems pretty odd, but simply resetting the simulator usually fixes this. We often encounter the same error on our own CI-system.
Try Simulator-Menu -> Reset Content and Settings, then restart the simulator.
You can enforce this on the command line, but I won't recommend it, cause it will slow down your build remarkably.
There is a bug in Xcode 11.3 and earlier which could manifest this way if you have Simulator.app running from another Xcode. There is a small race window in which this could happen. That was fixed in Xcode 11.3.1.
but...
There is a bug in Xcode 11.3.1 and later (through Xcode 11.4.1 as of this comment) which manifests this way as well. To workaround the issue, you can click on Simulator.app in Dock after it launches (even if it is foreground). Alternatively, you can enable pasteboard synchronization in Simulator.app via 'Edit -> Automatically Sync Pasteboard'.
I have not found a good solution to fix the root cause of this issue, but I have found a work around. If you simply open simulator before building your app in Xcode this issue is bypassed.
Just killing and reopening the simulator worked for me.
You can also check the Window menu of the Simulator app.
There could be one or more Simulator windows that are marked as using an [External Display]. When you select a window from the menu nothing will appear, however you will be able to press Cmd-W to close it.
After you've closed all windows using an External Display, the Simulator will start working properly again.
I am uncertain how one can select an External Display for a simulator, however it has happened to me a few times and just quitting the Simulator app did not help. I had to either do what I describe above, or restart the machine.
I'm no longer able to debug my Cordova app on the iOS simulator. I get the dreaded "We're unable to find the app ... you're trying to debug." error. I've tried all the troubleshooting steps, but nothing has worked so far.
I should note that this was working just fine. I was able to debug my app multiple times, with no issues, and then suddenly this error started, and nothing I've tried has fixed it.
Interestingly, the actual build logs in Visual Studio make it look like everything went fine:
Requesting debug on remote iOS device for buildNumber 6805 on server https://<redacted>:3000/cordova...
Debugging - Successfully Debugging on the device
{webDebugPort=9221}
Anyone have any ideas?
UPDATE 1
Tried this on my local OS X device, too, and got a similar result. Here are the actual build logs:
Unable to attach to debug. Check that http://Matts-Mac-mini:9221 is accessible.
We were unable to find the app you’re trying to debug. Check that the device is connected, awake, and unlocked. Also, make sure it has Web Inspector enabled.
------ Cordova tools 6.1.1 already installed.
Requesting emulate on iOS Simulator for buildNumber 522 on server http://Matts-Mac-mini:3000/cordova...
Emulated - Successfully sent to ios Simulator
------ Cordova tools 6.1.1 already installed.
Requesting debug on remote iOS device for buildNumber 522 on server http://Matts-Mac-mini:3000/cordova...
Debugging - Successfully Debugging on the device
{webDebugPort=9221}
It looks like things fail, but then the later messages (which appear right away) make it look like things worked. And the app is indeed running in the simulator on my Mac.
After the discussion in the comments, I believe that the issue here is using a shared machine for debugging. If there are multiple iOS simulators running on a machine at the same time (Typically because there are multiple users connected to the machine each running their own simulator) then remotebuild cannot guarantee that you connect to the correct simulator. This is because we use ios-webkit-debug-proxy which assumes that only a single iOS simulator exists, and doesn't expose a way to restrict which one it connects to.
If you are trying to debug an app in the simulator and there is another user with a different simulator, you may connect to the wrong simulator where your app will not be running, and that can cause the error that you see.
I'm using Xcode 6.1 and iOS Simulator 8.1. It takes a long time to run the simple apps that I've written using the iOS Simulator. Build process was ok but then the iOS Simulator will show the black blank launch screen then the app screen for like 5 minutes before the app launch. Many times it shows error "Lost connection to iPhone 6(/5/4s)". Tried to re-start Xcode and iOS Simulator, and MacBook Pro multiple times already. Tried to reset "Content and Settings" in the iOS Stimulator, but doesn't help.
What could be the possible causes? Any advice/solution? Thank you.
I suggest that you boot up the device that you want to use prior to the Build&Run in Xcode. If you hit Build&Run in Xcode while the device is not booted, you will need to wait for the device to boot. This can take a long time depending on your I/O load (eg: if Spotlight is indexing at the same time you are trying to boot, or if your home directory is on a slow volume like a network mount).
Just open up iOS Simulator.app ahead of time and select the device you want to test on from the Hardware->Devices menu. Then it will be ready when you need it.
Make sure 'slow animations' is not selected under the Debug tab in the iOS Simulator. That fixed the issue for me.
Googled on this issue and some said it's a Xcode bug with the 6.1 beta, but I had the 6.1 release version installed alreadt. I even try the 6.2 beta, hoping Apple has a fix for this, but no luck, still the same.
So desperate that I decided to upgrade my 3 years old MacBook Pro RAM and harddisk to SSD. Problem solved with the upgrade! The iOS Simulator runs normally now.
When I try to run my program, iOS Simulator goes black and displays this error:
Unable to boot the iOS Simulator.
When I click OK, Xcode shows this error:
Unable to run app in Simulator. An error was encountered while running (Domain = NSMachErrorDomain, Code = -300)
How I can I make it run again?
You probably are running two different instances of the iOS Simulator.
Clean the project. (CMD+SHIFT+K)
Quit Xcode.
Quit all instances of iOS Simulator.
Restart the computer.
Log in.
Make sure no instances of iOS Simulator are running (I had a wrong version set to Open At Login)
Run your project, and let Xcode open the right Simulator.
If you've recently updated XCODE and possibly have more than one installation you may need to specify which XCode is being used via the command line.
sudo xcode-select -s /Applications/Xcode6-Beta4.app/Contents/Developer/
Just Reset Content and Settings worked for me. Also clean the project once and build.
Am new to Blackberry-10 development,i am running an sample BB-10 application while running on blackBerry 10 Dev Alpha Simulator am getting error
Can anyone help me how to solve this problem.!!
Thanks
Restart the VM ware and connect to the simulator with the IP address again
Syncing and starting problems can occur with the simulator, or the Dev Alpha, when the application is running but not under the control of the IDE when you try to start the application again under the IDE control. Usually exiting the application on the simulator or Dev Alpha will solve the problem, but remember to respect the back-off-retry time requirements.
Other issues that cause these problems may be solved by rebooting the simulator OS and/or deleting the application from the simulator.