Possible Duplicate:
Saving UIColor to and loading from NSUserDefaults
I think to init user defaults, make NSDictionary, input data, and refisterDefaults. But this code has error.
//if UserFilter entry is nothing, create.
NSDictionary *defaultFilter = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:0] forKey:@"UserFilter"];
[userDefaults registerDefaults:defaultFilter];
//if UserBadgeColor entry is nothing, create.
UIColor *color = [UIColor colorWithRed:0 green:0 blue:0 alpha:1];
NSValue *valColor = [NSValue value:&color withObjCType:@encode(UIColor)];
NSDictionary *defaultBadgeColor = [NSDictionary dictionaryWithObject:valColor forKey:@"UserBadgeColor"];
[userDefaults registerDefaults:defaultBadgeColor];
Running, UserFilter part has no problem. But UserBadgeFilter part has error. Error line is last.
Thanks.