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 01-29-2010, 01:35 PM   #1 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 36
Default saving data

In my app I chose to use the NSUnarchiver/NSArchiver objects to read/write my data because implementation was very straightforward. Then, I save my data on app exit per recommendations I have seen. However, the problem is if users enter or change a lot of data and a crash happens they lose all their work for the session. Naturally I will try to resolve all crashes, but the data loss in the meantime seems unacceptable. So, I was considering switching to Core Data on the idea that it wrote changed data out more often. Because that involves quite a bit of work, I want to make sure I'm making the right decision in doing so. Does Core Data indeed write the data out more often? Is it worth the hurdle to do this? Also, I saw something that said writes on the iPhone were very expensive and negatively affected the lifetime of the device, which is why I chose to write the data on exit only in the first place. I could write the data using the archive methods more often, but that would potentially be a performance hit as I write out the full amount of data (vs Core Data writing only what has changed?). I'm looking for any advice on the best way to address these issues. thanks.
BrianMu is offline   Reply With Quote
Old 01-29-2010, 10:25 PM   #2 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 36
Default

ok, let me guess I wasn't specific enough. Questions I am hoping to get answers to:

1) Does Core Data write things to file more often so the user wouldn't lose data?
2) Is it bad to do too many writes to file or should I just save each time the user finishes with a particular view, for example?
3) Is there some better approach or hybrid here that I am not seeing but is recommended?
BrianMu is offline   Reply With Quote
Old 02-12-2010, 08:49 PM   #3 (permalink)
Registered Member
 
Join Date: Dec 2009
Posts: 36
Default

anyone? I have seen apps that allow the user to periodically manually write changes to disk. Seems a bit clunky. I am still trying to figure out:

1) do too many writes reduce the life of the iPhone device?
2) is there a particular save technology (nsarchiver, core data, etc...) that is preferred to reduce writes but keep data saved often enough?
3) Saving just on exit seems risky. Is there some other approach that people use (other than writing each time something changes) to keep data from being lost?

thanks for any insight...
BrianMu 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: 282
17 members and 265 guests
2WeeksToGo, ADY, apatsufas, dacapo, Dani77, Fritzer, ghost, HDshot, headkaze, mer10, mystic.purple, Rudy, smethorst, stoneage, superg, tathaastu, Zool
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,878
Threads: 89,224
Posts: 380,732
Top Poster: BrianSlick (7,129)
Welcome to our newest member, olga2000
Powered by vBadvanced CMPS v3.1.0

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