views:

50

answers:

3

Can you see the values of NSUserDefaults naywhere in the xcode debugger?

Just wondering if this is possible?

Thanks,

Nick

A: 

I haven't done it but you should be able to execute a po (print object) command on the user defaults like so:

po [[NSUserDefaults standardUserDefaults] valueForKey:@"someKeyName"] 

I prefer to wrap my defaults in a custom class and create a description method that dumps the defaults.

You can use the "defaults" command line utility to examine the defaults exactly. Read the man page for details.

TechZen
+1  A: 

I don't have a solution to view them in the debugger, but I can offer this:

NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSLog(@"%@", [defaults dictionaryRepresentation]);

For some caveman-debugging:)

RickiG
A: 

Not aware of any GUI that displays NSUserDefaults, but I use this in my application delegate to see the settings at start up:

- (void)applicationDidFinishLaunching:(UIApplication *)application
{
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSLog(@"%@ DEFAULTS = %@", [self class], [defaults persistentDomainForName:[[NSBundle mainBundle] bundleIdentifier]]);
} 
Typeoneerror