satya
satya

Reputation: 131

Doubt in Core Data

can we convert the sqlite file to core data sqlite and use it in our application?thanks in advance

Upvotes: 0

Views: 69

Answers (2)

Rahul K Rajan
Rahul K Rajan

Reputation: 796

1.I think you can migrate standard SQLite to coredata compatible SQLite

i am not sure about this please see the below link

https://github.com/tapasya/Sqlite2CoreData

2.Try this way too

There just isn't any automatic way. You'll need to

1.Load your existing data

2.Iterate over each entry

3.For each entry, create a corresponding managed object.

If you're using CSV, you can load the file into an NSString (if it isn't too big) and then iterate over each line. If you're using SQLite, you'll need to use either the SQLite API or one of the ObjC-style wrappers like FMDB or PLDatabase.

Upvotes: 1

Colin Wheeler
Colin Wheeler

Reputation: 3343

Probably not. Core Data creates it's own tables to map your entities to. As far as I am aware it's something you can just create a SQLite db and core data will magically start working. Probably the easiest thing to do is just to manually import the data from a SQLite database and create entities as appropriate in your app and save to a store in Core Data using SQLite database.

Upvotes: 1

Related Questions