问题描述
我使用open -n /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/ --args -CurrentDeviceUDID xxxxx
与任意数量的其他软件一起启动模拟器,并且我可以对xcrun simctl list | grep xxxxx
进行轮询,以找出启动引导程序的时间.
I use open -n /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app/ --args -CurrentDeviceUDID xxxxx
to start a simulator alongside any number of others, and I can poll xcrun simctl list | grep xxxxx
to find out when it's started its boot process.
如何确定模拟器已完成启动过程并在其主屏幕上处于空闲状态?
How can I determine that the simulator has finished its boot-up process and is idling at its home screen?
目前,我正在轮询~/Library/Logs/iOS Simulator/{version}/system.log
,直到它安静了几秒钟,但这还是很la脚.
Currently I'm polling ~/Library/Logs/iOS Simulator/{version}/system.log
until it's quiet for a few seconds, but that's kinda lame.
还有更好的东西,例如xcrun simctl getenv
吗?
Is there something nicer, like an xcrun simctl getenv
?
推荐答案
您可以轮询com.apple.springboard.services mach服务进行签入.例如:
You could poll the com.apple.springboard.services mach service for checkin. Eg:
~ $ simctl spawn booted launchctl print system | grep com.apple.springboard.services
0x1c407 M D com.apple.springboard.services
...
~ $ simctl spawn booted launchctl print system | grep com.apple.springboard.services
0x1c407 M A com.apple.springboard.services
使用最新的版本,您还可以运行xcrun simctl bootstatus <UDID>
来监视此进度.这些天可能比轮询launchctl更为优雅的解决方案.
edit:With recent builds, you can also run xcrun simctl bootstatus <UDID>
to monitor this progress. That's likely a much more elegant solution than polling launchctl these days.
再次除了使用'xcrun simctl bootstatus'监视进度之外,如果尚未启动,您还可以使用它启动启动.检查xcrun simctl help bootstatus
了解更多信息.
edit (again):In addition to using 'xcrun simctl bootstatus ' to monitor the progress, you can use it to kick off the boot if it hasn't started already. Check xcrun simctl help bootstatus
for more info.
这篇关于如何知道iOS模拟器何时启动到主屏幕?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!