Moving a SQLite database from device to simulator

I was working with my app on the device, and had built up some data that I wanted to get over to the simulator. Being the lazy developer that I am, I thought for sure that there should be a way to do this, and lo and behold, there is indeed.

To get the file from your device, open the Organizer window in Xcode, select your device from the left hand panel under Devices, and then find your application in the main part of the Organizer window under Applications. If you click the arrow next to your application, there should be an Application Data item that appears, and there is a down pointing arrow to the right. Click this arrow, and it will ask you to save the files from the device to a folder somewhere on your Mac hard drive.

Inside of this folder, you will see a Documents folder, and you should see your SQLite file there. You can then copy this file to the appropriate area for your simulator, which for me is:

~/Library/Application Support/iPhone Simulator/4.2/Applications/Your_application_UUID_here/Documents

After I copied the SQLite file to this location, I fired up the simulator, and all my data was there. Nice!

Leave a Reply