开发者

CoreData question

I have created application with corde data model to populate my sqlite database with data. What I want to put this populated database to iphone application. In iphone application proj开发者_如何学Cect I have added the sqlite database file that I had populated and have imported the mangedobjectmodel from my destktop application, but when I run the iphone application I get an error : reason = "The model used to open the store is incompatible with the one used to create the store"; Is it possible to use one managedobjectmodel in different applications, or I have to migrate the data from one managedobjectmodel to another.

Thank you for your help.


The exact model used to create the store must be available to the app. The model provides the only information that the Core Data stacks has to interpret the store as objects.

You must move the model from the MacOS app to the iOS app. If you need to change the model, you need to create a new version of the old model and then migrate the store from the old to the new.

This is actually easy to do. I quite often create models and pre-populated SQLite stores on my development Mac and then insert the results into an iOS app. Unless your making any changes as above, the process is seamless and no more difficult than importing the files into the project.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜