Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
672 views
in Technique[技术] by (71.8m points)

ios - Prefill information in Core Data at startup.

I have to do an iOS application that used core data to store the information.

I created the model and how to add data into the application, everything is working perfect, the only problem I have is that, the data model is empty, but I wanted to fill automatically with some data when the application is startup.

How can I do?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Take a look at some of the sample apps, like the iPhone Core Data Books. Basically you ship a pre-filled database with your app, and on initial startup your app delegate copies it into the application's Documents directory, using the data you populated in the database.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...