LavaSlider
LavaSlider

Reputation: 2504

How to copy-forward iOS simulator content

I have an iOS app in development and I made the foolish mistake up updating Xcode. Well the app reads from the calendar and I had entered many many many calendar events for testing purposes. With the simulator that opens with the updated Xcode all this is gone. Does anyone know a way to retrieve the old simulator calendar content and move it to the new simulator?

Upvotes: 0

Views: 190

Answers (2)

Jeremy Huddleston Sequoia
Jeremy Huddleston Sequoia

Reputation: 23623

You should use simctl to clone your device to a new one and then upgrade the OS version of the device.

See xcrun simctl clone --help and xcrun simctl upgrade --help

Upvotes: 1

LavaSlider
LavaSlider

Reputation: 2504

OK, I figured it out. From within my app I printed the path to the documents directory. This was ~/Library/Developer/CoreSimulator/Devices/F639B4A2-F69E-4297-AA04-9AD6C73EDAB1/data/Containers/Data/Application/72BB83B2-B216-48C4-B54C-0DE3D3C55E92/Documents I then looked in the ~/Library/Developer/CoreSimulator/Devices directory and searched for any of the devices that had Calendar data. This I found in 10B26A7E-26D3-4F85-ADD2-187A343E95CE/data/Library/Calendar. I then copied the all the files from there to the same directory in the current device path (the one printed from my app). This worked perfectly but is likely susceptible to any changes in the Calendar's data structures. I hope this helps someone else.

Upvotes: 0

Related Questions