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

/dev/toaster

macrumors 68020
Original poster
Feb 23, 2006
2,478
249
San Francisco, CA
Excuse my total newbie-ness. Not sure if I am heading in the total wrong direction with what I am trying to do. I am trying to use NSUserDefaults to store "state" information about a running application. For example, the last time the application was ran or a simple string.

Here is the code I am trying to use. It does generate the output, however it doesn't create the plist file. What am I missing ? This is driving me nuts!

NSMutableDictionary *defaultValues = [NSMutableDictionary dictionary];

NSString *mystring = @"TEST";

[defaultValues setObject:mystring forKey:mad:"mykey"];

[[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];

NSString* object = [defaultValues objectForKey:mad:"mykey"];

NSLog(@"VALUE FROM PLIST: %@",object);
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.