I've started a new iPhone app that needs to remember a single, 40-char string. That's it. I've hooked into Core Data, and am reading about it now, but it really seems like overkill. Is there an easier way to do something so simple?
+3
A:
NSUserDefaults would probably be the easiest way
// To Save
[[NSUserDefaults standardUserDefaults] setString:myString forKey:kMyStringKey];
//To Load
NSString * myString = [[NSUserDefaults standardUserDefaults] stringForKey:kMyStringKey];
This will persistence between sessions.
Edit: This is assuming of course that the string is not constant for everyone using the program. If it is you can just hard code it. This is for if every instance of the app needs a different string, but you want the string saved between runs of the app.
Brandon Bodnár
2010-03-20 18:40:27