Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-02-2012, 09:57 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 11
Marquisk2 is on a distinguished road
Default SQLite question

I have a SQLite database in my application and when I make any updates to the database and test it on my iPhone the database does not get updated unless I delete the app completely off my iPhone. Is this normal? Will this cause an issue with future updates when people download them as well?
Marquisk2 is offline   Reply With Quote
Old 02-02-2012, 10:39 AM   #2 (permalink)
Use [code] tags please
 
Join Date: Jun 2009
Location: Jacksonville, FL
Posts: 410
timle8n1 is on a distinguished road
Default

Quote:
Originally Posted by Marquisk2 View Post
I have a SQLite database in my application and when I make any updates to the database and test it on my iPhone the database does not get updated unless I delete the app completely off my iPhone. Is this normal? Will this cause an issue with future updates when people download them as well?
I suspect you are using code that checks if the database is present in the documents directory and if not copies it over. As you have noticed after an upgrade this database is already there and so the code doesn't copy it over - if it did all the data added since the app was last installed would be lost.

If you need to handle this use case (changing the schema after an install) you should probably look at Core Data and migration. While complex it will be much easier to learn that versus trying to do all that in raw SQL.
timle8n1 is offline   Reply With Quote
Old 02-03-2012, 02:38 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 11
Marquisk2 is on a distinguished road
Default

Thanks for the information. Maybe on my next project I'll work with Core Data but I figured to insert a version table/field where the app checks what version it has and updates if it needs to or not.
Marquisk2 is offline   Reply With Quote
Old 02-05-2012, 03:49 PM   #4 (permalink)
Registered Member
 
thenerd's Avatar
 
Join Date: Oct 2011
Location: Roeselare, Belgium
Posts: 18
thenerd is on a distinguished road
Default

Quote:
Originally Posted by Marquisk2 View Post
Thanks for the information. Maybe on my next project I'll work with Core Data but I figured to insert a version table/field where the app checks what version it has and updates if it needs to or not.
Yesterday I wrote how to on my blog when you want to migrate data between versions... its not so hard as you think it is!

You can check it out at How to do a lightweight Core Data migration | the-nerd

Cheers,
Fre
thenerd is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 419
16 members and 403 guests
Atatator, chiataytuday, dre, FrankWeller, imac74, ipodphone, jeroenkeij, kukat, LunarMoon, MAMN84, n00b, PowerGoofy, QuantumDoja, Retouchable, tim0504, VinceYuan
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,675
Threads: 94,124
Posts: 402,909
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Retouchable
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:04 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0