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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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 07-10-2008, 11:30 AM   #1 (permalink)
New Member
 
Join Date: May 2008
Posts: 22
Default Does an app update overwrite all files?

Hi,

I have an app that lets the user write notes and I store them to a database. I don't want this database file to be overwritten when I have an update to the application. Does anyone know if the update will overwrite all the files, or will it not overwrite files that are newer than they are? Or is there a way I can include a new database file, and then when the app loads, it imports from the old database (assuming the old database didn't get deleted with the update?

Thanks
fasttech is offline   Reply With Quote
Old 07-10-2008, 12:10 PM   #2 (permalink)
Registered Member
 
Join Date: Apr 2008
Posts: 59
Default Re: Does an app update overwrite all files?

I'm guessing that it works the way xcode does when putting a new version on the device... which is that it does not delete the existing files... unless the application is first deleted.

So... what I'm planning on doing for updates... is to check a small file that has the database version... if it's newer than the one in my "Documents" folder... then I'll export user data... copy over the database... and import the user data to the new one.

I'm not sure... but that would be the sensible way to do it.
brianr is offline   Reply With Quote
Old 06-03-2009, 03:41 AM   #3 (permalink)
New Member
 
Join Date: Jun 2009
Posts: 2
Default Request for code

Quote:
Originally Posted by brianr View Post
I'm guessing that it works the way xcode does when putting a new version on the device... which is that it does not delete the existing files... unless the application is first deleted.

So... what I'm planning on doing for updates... is to check a small file that has the database version... if it's newer than the one in my "Documents" folder... then I'll export user data... copy over the database... and import the user data to the new one.

I'm not sure... but that would be the sensible way to do it.
Please post code , I am finding solution to this problem.
vijaybsalunke is offline   Reply With Quote
Old 06-03-2009, 04:21 AM   #4 (permalink)
Registered Member
 
Join Date: Oct 2008
Location: London, UK
Posts: 249
Default

I've written something which checks the DB version against the version of the software and then runs a functions to upgrade the DB. So, if for instance the DB is at 1.0 and the software is at 1.1 then the function upgrade1_0To1_1 is run. But if the DB is at 1.0 and the software is at 1.2 then the function upgrade1_0To1_1 is run and then the function upgrade1_1To1_2 is run. It relies on you using an increment of 0.1 each time for versions, but for me that works fine. I've not actually deployed this yet, but I have the code working for it.
__________________
Beard Booth HD - See what you'd look like with a beard today!

My iPhone Apps
My iPhone Tutorials
mattjgalloway is offline   Reply With Quote
Old 06-03-2009, 05:28 AM   #5 (permalink)
New Member
 
Join Date: Jun 2009
Posts: 2
Default

Thanks for your quick response .

Actually what is happening with me is, When user upgrades application to new version then upgrading is unable to overwrite the default database provided by application in document directory of iphone , instead of that it is keeping older database as it is, so what can I do ?

Thanks in advance



Quote:
Originally Posted by mattjgalloway View Post
I've written something which checks the DB version against the version of the software and then runs a functions to upgrade the DB. So, if for instance the DB is at 1.0 and the software is at 1.1 then the function upgrade1_0To1_1 is run. But if the DB is at 1.0 and the software is at 1.2 then the function upgrade1_0To1_1 is run and then the function upgrade1_1To1_2 is run. It relies on you using an increment of 0.1 each time for versions, but for me that works fine. I've not actually deployed this yet, but I have the code working for it.
vijaybsalunke is offline   Reply With Quote
Old 06-03-2009, 05:39 AM   #6 (permalink)
Registered Member
 
Join Date: Oct 2008
Location: London, UK
Posts: 249
Default

It kind of depends how you're doing things. If the DB is in the bundle only (so read only in that case) then you shouldn't have any problems. But because you are having problems I assume that you copy the DB over to the home directory. Depending on your code, it will either overwrite it everytime or check if it exists and if so, not overwrite. Please post your code (probably in the app delegate) for when the DB gets copied.
__________________
Beard Booth HD - See what you'd look like with a beard today!

My iPhone Apps
My iPhone Tutorials
mattjgalloway 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Read / write / create data files Xavier iPhone SDK Development 12 01-17-2011 05:02 AM
Posting an app update fasttech iPhone SDK Development 2 07-11-2008 08:40 AM
How to save files in a build dynamically? satyanarayanagv iPhone SDK Development 0 06-10-2008 03:33 AM
zip/unzip files on iPhone , how i can do that ? abuarja iPhone SDK Development 1 05-15-2008 12:52 PM
Localization: which files go where? bonehead iPhone SDK Development 3 05-13-2008 01:41 PM


» Advertisements
» Online Users: 353
22 members and 331 guests
ADY, Dani77, Duncan C, e2applets, Grinarn, HemiMG, Herbie, JasonR, keeshux, linkmx, macquitzon216, mer10, Monstertaco, prchn4christ, Promo Dispenser, Robiwan, sebasx, sly24, Touchmint, twerner, zulfishah
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,881
Threads: 89,228
Posts: 380,760
Top Poster: BrianSlick (7,129)
Welcome to our newest member, macquitzon216
Powered by vBadvanced CMPS v3.1.0

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