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.
Related
I have configured the WatchKit App to run in my project (WatchOS2).
When I try to run it into the simulator the WatchKit App start perfectly, but each times I'm trying to start the iOS app, this one crash.
The simulator's log show me that :
com.apple.CoreSimulator.SimDevice.5F243C10-E98D-4A20-8950-2742FE6CABD5.launchd_sim[13288] (UIKitApplication:com.MyCompany.MyProject[0x847][13496]): Service exited due to signal: Trace/BPT trap: 5
All of my code in the application delegate is in comment. just enough to start
If I build and use my main app target with the same simulator setting, that works nicely. it just when I build and run the watchkit extension target.
I tried to clean everything (derived data, simulator setting and contents).
I know, it is not the simulator, because with a new project, the issue is not here. it might be something set somewhere ??
but nothing works, any idea ?.
Your application aborted, likely due to a failed assertion. You should look at the crash log (in ~/Library/Logs/DiagnosticReports) for more details.
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.
I'm using Xcode 6.1, iPhone 6 simulator for my Appium automation tests.
I'm having a trouble of reset iOS simulator. The first time after reboot using simulator is always fine. But if I quit the simulator, and tried to use it again (both manually and load using Appium tool), I'll keep getting blackscreen for simulator. I got the following info from my automation log 'Could not reset simulator. Leaving as is. Error: Command failed: // stderr'
I've tried the 'Reset Content and Settings' from simulator, it would not help. I still getting the black screen. and I've also tried to kill the simulator from command line using 'killall SimulatorBridge', still not work.
The only way that I could get this working is - reboot my laptop... this gives me a big pain. I'm thinking if reboot could help, there must be some process that I could kill to reset it? Anyone could kindly give me some help here? Many thanks!
I know this is an issue that was already discussed here many times before, But there is now solution for my problem and its really serious.
Every second time I try to run the simulator i get get this bothering message:
"The Simulator can't be launched because it is already in use."
Closing the simulator does not help.
I need to quit Xcode every single time this happens!
I trying restarting my computer several times.
Please help me, I find my self restarting Xcode 50 times a day. This is totally frustrating.
Very simple, to avoid further problems we will do "complete" procedure.
On iOS Simulator, you must force quit.
In Xcode, press COMMAND + SHIFT + "K" (letter k) keys; to empty the cache of the application and ensure that all works out.
On then quit Xcode (I recommend that you restart your Mac after this procedure done, if the problem persists)
Good luck
I had the same issue. Turned out that the developer tools path was set to a different location than the Xcode I was using. So check with
xcode-select -p
that your dev tools path is set correctly. If not, fix with
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer/
if you're using the current AppStore version of Xcode (or the appropriate path to your alternate Xcode).
I think it a bug in Xcode 5.1. Update your Xcode and it will resolve your issue
and i use this solution for this issue. "Close all application from background and then run"
To close application from background use
Select simulator then press "Ctrl+Shift+H+H" So it open background task screen in this close all application from background and then run your application from Xcode.
i hope this will solve you lots of time of restarting the Xcode.
Solution that seems to be working :
double press CMD+Shift+H (in simulator )
close All other apps on
sim.
Works for me. Let me know!:)
I'm getting an warning as 'SpringBoard failed to launch application with error: -3'. This happens when trying to run application in Xcode 5.
Finally...found solution!
Solution 1 : Just quit Simulator and clean Xcode. The fresh build will not show this Alert again. The possible reason for this might be switching between 64-bit simulator and 32-bit simulator.
Solution 2 : If the problem still persists then delete the App from Simulator and re-run the code. This will work since the app contents are freshly loaded.
Springboard (also known as Home Screen) is the standard application that manages the iOS home screen.
Also, these may be bug of Xcode 5.0.2. I haven't encountered any such error in Xcode 5.1 (Beta) version.
just close the simulator, clean it your project, built it again, and launch again. Its work on me.
It also works to clean your code and then go to iOS Simulator -> Reset Content and Settings. Just an alternative if you don't want to close and reopen your Simulator (mine takes forever to quit and reopen)
Just had the same problem.
After trying what evanhutomo failed for me, I tried a slight variation.
Install 6.1 simulator
Run in 6.1 simulator
When it fails you should be dropped on the spring board
Delete the application.
Try building again
Hope this helps.
Deleting the app from the simulator and then rebuilding and running helped me solve the problem.
I tried the other solutions here, but none worked. From another SO answer I tried setting App Support/iPhone Simulator directory recursively to 777 permissions.
$sudo chmod -R 777 "~/Library/Application Support/iPhone Simulator/"
I'm not recommending this, just saying it took care of the problem for me!