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
?
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)' .
Selecting Reload (or pressing ⌘ + r in the iOS simulator) will reload the JavaScript that powers your application.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With