When you start a new iOS project on Xcode using core data, it initializes a database with the extension .sqlite
. When you do the same thing for a new project for OSX the database has the extension .storedata
.
Is there any difference between the two? thanks.
CoreData on iOS only supports an sqlite persistent store. CoreData on OS X supports multiple formats including sqlite and xml, with the default persistent store being xml-based. Thus .sqlite is an sqlite persistent store for CoreData, whereas .storedata is an xml persistent store.
To expand on the answer, an sqlite persistent store allows the model to be partially and incrementally loaded, whereas an xml persistent store only allows (requires) the model to be loaded en masse. The difference in defaults is probably explained by the differing memory availability on the two platforms. With much more memory available on a typical Mac, the overall performance is enhanced by loading everything at once.
To switch the default code to use sqlite instead of xml, edit
persistentStoreCoordinator
and change:to: