The Cookbook

Core Data: Automate master data preloading

Problem

Given a generic iOS application ‘Blog’ with data model as below:

We want to prepopulate data for ‘Categories’ table in our SQLite database.

Solution

This solution uses the approach described in Core Data on iOS 5 Tutorial: How To Preload and Import Existing Data, we will create an OS X Command Line Tool application, which will reference the data model in our ‘Blog’ application and prepopulate the data. Except we automate the building process.