Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell when the iOS simulator has booted to its home screen?

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?

Currently I'm polling ~/Library/Logs/iOS Simulator/{version}/system.log until it's quiet for a few seconds, but that's kinda lame.

Is there something nicer, like an xcrun simctl getenv?

like image 379
android.weasel Avatar asked May 04 '16 16:05

android.weasel


People also ask

Which command is used to run the app on iOS simulator?

You can specify the device the simulator should run with the --simulator flag, followed by the device name as a string. The default is "iPhone 13" . If you wish to run your app on an iPhone SE (2nd generation), run npx react-native run-ios --simulator='iPhone SE (2nd generation)' .

How do you refresh iPhone simulator?

Selecting Reload (or pressing ⌘ + r in the iOS simulator) will reload the JavaScript that powers your application.

How does the iPhone simulator work?

An iOS Simulator basically mimics an iOS app or browser on top of a developer's operating system. This is viewable in an iPad or iPhone like window. They cannot virtualize the actual hardware conditions of an iOS device, which is the main requirement for comprehensive testing and debugging.


1 Answers

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

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.

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.

like image 109
Jeremy Huddleston Sequoia Avatar answered Sep 30 '22 03:09

Jeremy Huddleston Sequoia