iOS Simulator changes plist config after setting manually

38 views Asked by At

I am setting up an automation to boot iOS simulators for end-to-end testing I'm doing this by

  1. creating a new device
  2. booting it
  3. waiting some time
  4. 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:

  1. Check that a device has finished it first boot, so I can change the settings without them resetting
  2. Detect when the device resets this change without having to manually sit on a machine for 5 minutes
  3. Have a better method to check the true boot state of the device
0

There are 0 answers