I am setting up an automation to boot iOS simulators for end-to-end testing I'm doing this by
- creating a new device
- booting it
- waiting some time
- changing settings manually
Which put together looks like this:
DEVICE_ID=$(xcrun simctl create "iPhone 14" "iPhone 14" "ios17")
xcrun simctl boot $DEVICE_ID
sleep 60
plutil -replace restrictedBool.allowPasswordAutoFill.value -bool NO ~/Library/Developer/CoreSimulator/Devices/$DEVICE_ID/data/Containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles/Library/ConfigurationProfiles/UserSettings.plist
plutil -replace restrictedBool.allowPasswordAutoFill.value -bool NO ~/Library/Developer/CoreSimulator/Devices/$DEVICE_ID/data/Library/UserConfigurationProfiles/EffectiveUserSettings.plist
plutil -replace restrictedBool.allowPasswordAutoFill.value -bool NO ~/Library/Developer/CoreSimulator/Devices/$DEVICE_ID/data/Library/UserConfigurationProfiles/PublicInfo/PublicEffectiveUserSettings.plist
This all works at first, but after a period of time, in seconds or minutes it depends on how the simulator is feeling, it will revert back to these values being YES
.
It feels like a race condition, as sometimes it will happen, sometimes not.
Is there a way that I can either:
- Check that a device has finished it first boot, so I can change the settings without them resetting
- Detect when the device resets this change without having to manually sit on a machine for 5 minutes
- Have a better method to check the true boot state of the device