How to convert a Persistent Store from XML to SQLite in Core Data

By default Mac Apps use XML as store type when saving in Core Data, even though it can use other formats – such as SQLite, which is the default on iOS. Here’s a way to quickly convert one into the other.

Note that this is designed as a one-off operation to create a new store file which can be used in another application. Once run, comment the code out and either change your store file, or take the store file and use it in another app.

Add this code to the AppDelegate.m file in the persistenStore method (just before the return statement):

For more information on how to do this in context, check out Simon Allardice’s superb course Core Data for iOS and OS X on Lynda.com.

About Jay Versluis

Jay is a medical miracle known as Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.