Radrider33
Radrider33

Reputation: 557

Populating core data with predefined data?

I am making an app which displays several predetermined locations on map. I've chosen to use core data to store the locations. How would I go about loading the predefined data into core data the first time the app launches? I also do not want this data to be user editable. I'm sure there is a simple way to do this, I just can't seem to figure it out. Thanks in advance for the help!

Upvotes: 1

Views: 534

Answers (1)

Jody Hagins
Jody Hagins

Reputation: 28419

If the data is constant, and will never change, just use separate databases. Create your read-only database on your mac (using the simulator is best). Then, just copy that file into your xcode resources, and have it built into the application bundle.

You can also provide a user database using the exact same model. That way, you always have the "seed" read-only data in the bundle, and you can have a mutable database for the user's data.

Upvotes: 1

Related Questions