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 04-21-2009, 01:00 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 9
BebopSong is on a distinguished road
Question Best way to create & store data that can be read & written to?

Hi,

Can anyone tell me the best way to create and store data on the iPhone so that the app can read the data but also write to it?

I am creating an app that has a main list of items that the user can pick from to go into their own seperate list. I have been looking at property lists, which look like a good option to me but wasn't sure if I am missing other better types as I am new to Objective-C, iPhone SDK and Cocoa.

There will be quite a bit of data in the main list and the user will be constantly writing to and from their list, does this affect which data type to use?

Thanks in advance.

BebopSong
BebopSong is offline   Reply With Quote
Old 04-21-2009, 02:03 AM   #2 (permalink)
Dr. Touch Cocoa Helpdesk
iPhone Dev SDK Supporter
 
Join Date: Sep 2008
Location: Vienna, Austria
Posts: 537
Oliver Drobnik is on a distinguished road
Send a message via AIM to Oliver Drobnik Send a message via MSN to Oliver Drobnik Send a message via Skype™ to Oliver Drobnik
Default

Quote:
Originally Posted by BebopSong View Post
Hi,

Can anyone tell me the best way to create and store data on the iPhone so that the app can read the data but also write to it?

I am creating an app that has a main list of items that the user can pick from to go into their own seperate list. I have been looking at property lists, which look like a good option to me but wasn't sure if I am missing other better types as I am new to Objective-C, iPhone SDK and Cocoa.

There will be quite a bit of data in the main list and the user will be constantly writing to and from their list, does this affect which data type to use?

Thanks in advance.

BebopSong
Plists are fine for small amounts of data, but the drawback is that you don't have random access, you always need to read/write the whole file.

For iWoman I used encodeers/decoders because at that time I thought that SQLite was too difficult.

But for GeoCorder I tryied out SQLite and now I would not do anything else. I learned the most from the SQLite Books example, copyied most of my data code from there.

With 3.0 comes Core Data and this will most likely be the standard way to do it beginning in June. I played a little with it and it is very cool, although you lose the ability to customize your table structure it will fit 99% of devs.
__________________
regards

Oliver Drobnik
Cocoanetics - Our DNA is programmed in Objective-C.

Linguan – makes localizing strings file fun!

Cocoanetics Parts Store – easy to use yet professionally looking components that you can use to spruce up your own apps. Augmented Reality, Calendar Control, Pin Lock or Purchase Button are only some examples. You get full source code, no static library crap, and lifetime support. Check it out today!
Oliver Drobnik is offline   Reply With Quote
Old 04-21-2009, 03:11 PM   #3 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 9
BebopSong is on a distinguished road
Default

Thanks for the quick response, I will look into SQLite.
BebopSong is offline   Reply With Quote
Old 04-21-2009, 03:23 PM   #4 (permalink)
iPhone Development Traine
 
Join Date: Dec 2008
Location: Philadelphia, PA
Posts: 146
MattjDrake is on a distinguished road
Send a message via Skype™ to MattjDrake
Default

SQLite is one way that I use, but it is a little bit of work. If you are not dealing with massive amounts of data then you could probably just use NSMutableArray or NSMutableDictionary. They have methods built in that read and write data - plus you can nest the arrays if you are feeling clever.

Here is a blog post where I wrote some code that does this:

How to Save the Contents of an Array to the iPhone’s Filesystem | How to Make iPhone Apps
__________________
Click this to read my blog: How To Make iPhone Apps

Author of Objective-C Recipes, blogger and trainer
MattjDrake is offline   Reply With Quote
Reply

Bookmarks

Tags
data, lists, memory management

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: 323
7 members and 316 guests
blueorb, guusleijsten, jbro, Kryckter, mer10, n00b, SLIC
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,649
Threads: 94,113
Posts: 402,880
Top Poster: BrianSlick (7,990)
Welcome to our newest member, Anwerbl
Powered by vBadvanced CMPS v3.1.0

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