About

This is the developer blog of Simon Wolf, Mac and iPhone developer, owner of Otter Software Ltd.

I am currently available for contract work so please get in touch to see if I can help you.

Twitter Accounts

Entries in xml (1)

Tuesday
Feb222011

Switching Between XML and SQLite in Core Data 

Of the four data storage formats which Core Data on OS X supports some developers may use two: XML and SQLite. XML can be great when you are developing your application and want to have a look at what Core Data is storing whilst SQLite is more memory friendly and is generally used in shipping applications (the XML format is easy to read in a text editor but more memory hungry because it loads all of the data into memory). Note: After initially publishing this post I received some feedback on Twitter about the perils of using an XML data store. This is covered in a section at the end of this post.

If the initial development was done using the XML store the developer will at some point throw away the existing test data and reconfigure the NSPersistentStoreCoordinator to use SQLite and then stick with that format. Whilst third-party tools exist which allow you to examine the data in the SQLite data store it easy to toggle between XML and SQLite using Core Data itself. This not only allows you to examine the data easily but it also means that when you transition from XML to SQLite you need not lose any data, possibly important if you have alpha or even beta testers using your application.

Click to read more ...