xcode write and read to plist or txt files

xcode write and read to plist or txt files

Hello All

I am fairly new to xcode and interface builder. Steep learning curve however good progress, Good enough to find this excellent site.

I have spent the last few nights up trying to work out how to save textfield variables (or any other for that matter) into plist or txt files.

Basically I am looking to take the values of a couple of text fields in a simple app and save them so that next time the app runs the values remain.

I know I need to
- check for documents path
- check for file index
- create file if it does not exist
- Write values into file upon exit (applicationWillTerminate)
- populate textfields with values when app loads

Been through loads of tuts and so far I have a couple of built and running applications no crashs but no saved data either.

Cant even pull my hair out cos I got none.

Please could someone help me.

Thanks
Bosco

The Reddest
04/18/2011 - 16:08

Check out this tutorial on using the NSUserDefaults class. I think it will work quite well for your app.

reply

Add Comment

Put code snippets inside language tags:
[language] [/language]

Examples:
[javascript] [/javascript]
[actionscript] [/actionscript]
[csharp] [/csharp]

See here for supported languages.

Javascript must be enabled to submit anonymous comments - or you can login.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.