How To Determine a tvOS Simulator Started and Ready?

67 views Asked by At

I'm working on an Ant build automating start/boot of a tvOS simulator, installs app in the running simulator and launch.

When I execute install-to-simulator command, many a time it appears that the simulator is not fully started yet, hence thrown an error like:

[exec] Unable to lookup in current state: Shutdown

I added a delay of 10 seconds between the start-simulator and install-to-simulator commands, but that solution isn't sufficient either.

How I can determine the state of a particular simulator? Or, how to ensure that the simulator is properly started and not in 'Shutdown' state anymore?

1

There are 1 answers

0
Santanu Karar On

Initially I tried to find a solution with following command:

xcrun simctl spawn booted log stream

Unfortunately, I couldn't able to find much of an answer to my needs from the available options.

Thus, I chose to resort on following command:

// since I have simulator UDID already available
xcrun simctl list devices available | grep '$UDID'

This returns me a string output in following way:

Apple TV 4K (3rd generation) (Booted | Shutdown)

Therefore a string-check for "(Booted)" or "(Shutdown)" from the output value, does the job for me.