Posted tagged ‘Can’t find model for source store’

Core Data Error: Can’t Find Model for Source Store

July 29, 2009

Well, I’m still learning how Core Data works and how it works with iPhone OS 3.0. The following displays how I was able to resolve an error running an app using Core Data and a pre-populated SQLite database. The error gives the reason as “Can’t find model for source store”.

1. Create a new SQLite database with the following tables and columns.

Table

Column

ZFriends
FirstName
LastName
Z_METADATA
Z_VERSION (Int Primary Key)
Z_UUID (VARCHAR(255))
Z_PLIST (BLOB)
Z_PRIMARYKEY
Z_ENT (Int Primary Key)
Z_NAME (VARCHAR)
Z_SUPER (INTEGER)
Z_MAX (INTEGER)

ZFriends is an example of the pre-populated table with the columns (or attributes) FirstName and LastName. Z_METADATA and Z_PRIMARYKEY are the tables necessary for Core Data functionality.

2. Create the Data Model (xcdatamodel file) in XCode.

image

a. Create the Entity (Table Name without the leading ’Z’).

b. Create the attributes (Columns).