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 09-07-2011, 03:27 AM   #1 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default store data

How do you save data in your app so it stays there after the app has been shut off.

i.e. I want the user to enter some information the first time they open the app and then keep that information stored.

Is there any good tutorial on this?
or is it too easy to even make a tutorial about?

Cheers!
thehindutimes is offline   Reply With Quote
Old 09-07-2011, 03:38 AM   #2 (permalink)
myCustomUserTitle
 
marketshow's Avatar
 
Join Date: Dec 2010
Location: Athens
Age: 27
Posts: 79
marketshow is on a distinguished road
Default

NSUserDefault is the keyword u r looking for.

It keeps user data in most apps! Check it out!

Last edited by marketshow; 09-07-2011 at 04:11 AM.
marketshow is offline   Reply With Quote
Old 09-07-2011, 04:06 AM   #3 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default

thanks!
thehindutimes is offline   Reply With Quote
Old 09-07-2011, 05:42 AM   #4 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

User defaults can only store objects that conform to NSCoding protocol (meaning they can be archived to NSData).

The answer to your question really depends on the type and the amount of data to be stored.
baja_yu is offline   Reply With Quote
Old 09-07-2011, 06:06 AM   #5 (permalink)
myCustomUserTitle
 
marketshow's Avatar
 
Join Date: Dec 2010
Location: Athens
Age: 27
Posts: 79
marketshow is on a distinguished road
Default

baja_yu is right.
I assumed from what u said that u wanted to store info like username,email,birthday etc.

In those cases NSUserDefault will fit your purpose depending on the amount of data ofcourse.

Last edited by marketshow; 09-08-2011 at 07:16 AM.
marketshow is offline   Reply With Quote
Old 09-07-2011, 07:19 AM   #6 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default

Yes, I only need to store username, email and such once.
thehindutimes is offline   Reply With Quote
Old 09-08-2011, 05:39 AM   #7 (permalink)
Registered Member
 
Join Date: Aug 2011
Posts: 53
thehindutimes is on a distinguished road
Default

Can you use NSUserDefault to store data and then load that data into an email?
thehindutimes is offline   Reply With Quote
Old 09-08-2011, 06:46 AM   #8 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

Yes, you can save and load at any time. If you're using MFMailComposer, you need to load it before you present the controller so you can populate it's fields.
baja_yu 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: 381
8 members and 373 guests
apatsufas, JackReidy, jeroenkeij, Sami Gh, tim0504, UMAD, yomo710
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,671
Threads: 94,121
Posts: 402,904
Top Poster: BrianSlick (7,990)
Welcome to our newest member, JackReidy
Powered by vBadvanced CMPS v3.1.0

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