Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

psxp

macrumors 6502
Original poster
Jan 8, 2008
405
477
Hi,

I have read the online documentation at the the DevCentre, and also scoured the forums here and there for help.

I seemed to have missed the concept of how to store/save application data to the iphone for use later.

ie. I have the user key in some text fields, make some selections, pick a picture from the camera roll. I would like to save this data to a file so it can be read back into the application later. Would I use the NSData object and the underlying "save to file" method from it?

any help, or pointers would be MUCH appreciated.

thanks!
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
For application state (so as you can restore the UI to the same position as it was when the user last used it) I would simply store into NSUserDefaults unless it's a massive amount of data.
 

psxp

macrumors 6502
Original poster
Jan 8, 2008
405
477
For application state (so as you can restore the UI to the same position as it was when the user last used it) I would simply store into NSUserDefaults unless it's a massive amount of data.

lets just say 50 - 100 data objects.. each with 5 text fields consisting of say 200 chars max and one photo/image per object. So the file would be in the kilobytes in size, not megs, BUT the image is the problem - I was thinking of just saving the path to the image file in the camera roll if I cant save with the application data.

What I am saying here, is that I dont need to use SQLLite do I? that would be over kill right??
 

robbieduncan

Moderator emeritus
Jul 24, 2002
25,611
893
Harrogate
Sounds like more data that you should be saving in NSUserDefaults. Save it to the application specific area in whatever way you like (create a NSDictionary and save that for example) as described in the File and Data Management page of the Application Design Guidelines section of the iPhone OS Programming Guide.

You might want to consider a few NSDictionaries if some of the data is going to be loaded and some not...
 

psxp

macrumors 6502
Original poster
Jan 8, 2008
405
477
Sounds like more data that you should be saving in NSUserDefaults. Save it to the application specific area in whatever way you like (create a NSDictionary and save that for example) as described in the File and Data Management page of the Application Design Guidelines section of the iPhone OS Programming Guide.

You might want to consider a few NSDictionaries if some of the data is going to be loaded and some not...

Hey, thanks for the pointers. I will re-read the File and Datamangement chaper now.

cheers.

B
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.