PDA

View Full Version : Loading Pre-filled sqlite database into your app




AndyCodez
Nov 24, 2009, 07:17 PM
I've been trying to get this going for a while. My main goal is to use a pre-filled database within my app instead of filling on first load. Due to that I'm loading 1600 rows from a csv file and it takes wayyy to long.

I've tried a couple different methods while adding it to the resources in xcode. Is there something simple I am missing here? Doesn't work like images and sound apparently.

Thanks for any help you offer ;)



tutukun
Nov 24, 2009, 09:37 PM
I've been trying to get this going for a while. My main goal is to use a pre-filled database within my app instead of filling on first load. Due to that I'm loading 1600 rows from a csv file and it takes wayyy to long.

I've tried a couple different methods while adding it to the resources in xcode. Is there something simple I am missing here? Doesn't work like images and sound apparently.

Thanks for any help you offer ;)

If you have someway to read sqlite file, i think you dont have to add it to the resource. just use direct path to open the file.

kainjow
Nov 24, 2009, 09:54 PM
Add it to the Resources group, and make sure it is listed under the Copy Bundle Resources group under Target > [Your App]. Then you can use NSBundle to get the absolute path of the file.

AndyCodez
Nov 25, 2009, 08:55 AM
Ok thanks! I'll try that tonight :)

AndyCodez
Nov 29, 2009, 09:16 AM
That worked great! Accept It seems the database is read only. I had a table that was used for score keeping and when the app tries to write to the database it isn't saving.

Do you know of read-only issues with using these pre-filled databases?

EDIT: Nevermind, found out resources group is read-only.