1

When I run the simctl launch command to launch an app in iOS Simulator, the app may or may not come up, depending on how long it takes for the iOS Simulator to get its act together. The following observations lead me to believe that there is some sort of a timeout involved, but it's not apparent from the limited simctl documentation what that timeout is and how to control it.

When launching the app, it may not launch (iOS Simulator comes to the home screen) if the app is not up in anywhere from 35-90 seconds. However, if the app manages to launch in under 20 seconds, it always comes up.

If first launch fails, same app, same machine, same command will usually succeed on 2nd or 3rd attempt as whatever needs to 'warm up' does so.

I am guessing the timeout is probably 30 seconds. How can I set it to a larger value?

Update:

Here's our exact sequence of events:

  1. If device is shut down, boot it (simctl boot ...) and wait for status to change to Booted in simctl list
  2. Uninstall app (simctl uninstall ...)
  3. Install app (simctl install ...)
  4. Shut down the device (simctl shutdown ...) and wait till it has shut down
  5. Start iOS Simulator (open -a "<path to simulator> --args -CurrentDeviceUDID <device id>)
  6. Wait for device to reach status Booted
  7. Launch app (simctl launch ...)

It is this last step that doesn't always succeed. There is no error, the app just doesn't come up.

Michael Teper
  • 4,591
  • 2
  • 32
  • 49

2 Answers2

2

There is no way to configure the timeout to be higher than 30s. 30s is already extremely high for the issue we have the timeout for (waiting for the system app to checkin). Assuming the device is already booted, that should not be an issue.


Update:

Based on the updated question, it is now clear that the device is being booted via 'simctl boot' rather than with the iOS Simulator. Currently, if you boot a device from the command line, it is only available for NonUI work (eg: unit tests) because the device is configured to not have a head attached to it. If you try to launch an app in this state, you will get an error because the system app is unavailable to respond to the launch request. I suspect you may instead want to do something like I describe in my answer to Xcode 6 - Launch simulator from command line

open -a "iOS Simulator" --args -CurrentDeviceUDID <DEVICE UDID>
simctl install ...
simctl launch ...

In other words, start at step 5.

If the iOS Simulator is already running, you have to switch to another device from the iOS Simulator GUI (or kill the process and relaunch it with the command line argument as above).

If the issue happens in the absence of using 'simctl boot', please update.

Community
  • 1
  • 1
Jeremy Huddleston Sequoia
  • 22,938
  • 5
  • 78
  • 86
  • Hmm, I've got a user on a 2012 Mac Mini (8Gb RAM, nothing else going on on the machine) who is routinely running into this limit. Our code checks waits for device status to be booted before attempting to launch the app. Is there anything else we should wait on? – Michael Teper Jan 29 '15 at 03:39
  • Well, all we are doing in steps 1-4 is updating the app, so it doesn't sound like that should make a difference, however I will move these steps to after step 5 and let you know if there is any change. Thanks again! – Michael Teper Jan 29 '15 at 20:34
  • This got resolved with, of all things, a reboot. Go figure! In any event, thank you for your help, and for confirming the 30 second timeout. – Michael Teper Jan 30 '15 at 17:02
0

We had those issues exactly until we've upgraded hardware to device with SSD drive. Similarly to iPhoto... the iOS Simulator ceised to be usable on computers with classical hard drives. This seems like one of ways, how to force developers buy new hardware even though the old one would still work well.

igraczech
  • 2,408
  • 3
  • 25
  • 30