简体   繁体   English

如何确定 tvOS 模拟器已启动并准备就绪?

[英]How To Determine a tvOS Simulator Started and Ready?

I'm working on an Ant build automating start/boot of a tvOS simulator, installs app in the running simulator and launch.我正在研究 Ant 构建自动启动/启动 tvOS 模拟器,在运行的模拟器中安装应用程序并启动。

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:当我执行 install-to-simulator 命令时,很多时候模拟器似乎还没有完全启动,因此抛出如下错误:

[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.我在 start-simulator 和 install-to-simulator 命令之间添加了 10 秒的延迟,但该解决方案也不够。

How I can determine the state of a particular simulator?我如何确定特定模拟器的 state? Or, how to ensure that the simulator is properly started and not in 'Shutdown' state anymore?或者,如何确保模拟器正常启动,而不是在 'Shutdown' state 了?

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:这将按以下方式返回一个字符串 output:

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

Therefore a string-check for "(Booted)" or "(Shutdown)" from the output value, does the job for me.因此,对 output 值中的“(Booted)”或“(Shutdown)”进行字符串检查就可以完成这项工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM