iPhone Simulator problem – Corrupted Device
The system I inherited kicks off builds via Jenkins, so I saw this error in the Jenkins output
An error was encountered processing the command (code=146):
Unable to erase contents and settings in current state: Creating
10:40:48 355) Business-Cards samples Batch 15 Business-Cards sample 355: biz-card-martin_0128.JPG
10:40:48 Failure/Error: Appium::Driver.new(desired_caps).start_driver
10:40:48 Command failed: /bin/sh -c xcrun simctl erase 8EFADEC6-6E22-482A-9810-5B0822653235
10:40:48 An error was encountered processing the command (code=146):
10:40:48 Unable to erase contents and settings in current state: Creating
10:40:48 # ./image_library_tests/image_library_regression.rb:67:in `block (4 levels) in <top (required)>'
- This means the virtual device, got corrupted and needs to removed and added back in, doing it command line often doesn’t work.
- Go to the VM in question, launch the iPhone simulator. You will probably get a pop up (the “device” trying to display with a message notification that has the unable to erase message.
- Switch to a different device, by going to the menu for the Simulator and clicking on Hardware -> Devices and choosing any other device.
- Then go to Hardware -> Devices -> Manage Devices (button of the device list)
- When the pop up appears, select the problem device and choose delete (if you son’t switch devices first (step 2) this device will be active and you can’t delete it)
- Then hit the plus key “+” (at the bottom) and then create a new version of the device you just deleted (in my case I had to delete an iPhone 6 and create a new iPhone 6)
- You’re done, just update any files that might use the unique identifier in them