Reputation: 15904
When using core data in my iphone application, I will create xdatamodel and internally all the data will be stored in sqlite. Here, I've created two sqlie database files (as per my client requirement) populated with all the data necessary. One for admin users and other for regular users. Now I want to use these sqlite files to be used by xdatamodel. How can I achieve this?
Upvotes: 0
Views: 170
Reputation: 17012
Although it's true that the default storage backing strategy for Core Data is sqlite, it is recommended that if you are using Core Data, you don't try and fiddle with the sqlite database behind it. Although it might be feasible (e.g. see this guy), you are introducing maintainability issues (e.g. if Core Data internals change).
A better approach is the load your data into Core Data storage at the application's first launch. You can do this by storing the initial data as sqlite, plists, JSON, or whatever appropriate in your app bundle. If you take this robust approach, things won't break randomly at some unknown time in the future.
Upvotes: 2
Reputation: 14694
You can't, at least not in the way you are thinking. If you really need to use those databases the you will have to include them in your app bundle and on first launch import the data using core data.
Another feasible option is to skip core data altogether and use something like FMDB.
Upvotes: 0