Re: NSUserDefaults Problem
Re: NSUserDefaults Problem
- Subject: Re: NSUserDefaults Problem
- From: "Max Seelemann.de" <email@hidden>
- Date: Fri, 2 Aug 2002 22:26:13 +0200
+ (void)initialize
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults integerForKey:@"numViewer"] == nil)
[defaults setInteger:1 forKey:@"numViewer"];
}
This doesn't work because you get an integer back.
And an int can't be nil. An int has always an value.
Use NSNumer and then:
+ (void)initialize
{
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
if ([defaults objectForKey:@"numViewer"] == nil)
[defaults setObject:[NSNumber numberWithInt: 1]
forKey:@"numViewer"];
}
didn't test it but must work...
cheers
MAX
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.