Re: Problem with NSUserDefaultsController
Re: Problem with NSUserDefaultsController
- Subject: Re: Problem with NSUserDefaultsController
- From: "Kyle Sluder" <email@hidden>
- Date: Mon, 1 Sep 2008 15:28:39 -0400
On Sun, Aug 31, 2008 at 12:13 PM, Mark Allan
<email@hidden> wrote:
> For what it's worth, I also get these compiler warnings for the line with
> [sharedUserDefaultsController save:]
>
> warning: multiple methods named '-save:' found
> warning: using '-(void)save:(id)sender'
> warning: also found '-(BOOL)save:(NSError **)error'
The compiler doesn't know which method you're trying to invoke,
because +[NSUserDefaultsController sharedUserDefaultsController] is
typed to return id. You need to cast the return value of this method
call as an NSUserDefaultsController to satisfy the compiler. Also,
you aren't storing the value of [super init] in self, which is
incorrect. Your -init method needs to look like this:
> -(id)init
> {
> if(self = [super init]) // one = is intentional
> {
> NSUserDefaultsController *shared = [NSUserDefaultsController sharedUserDefaultsController];
> [shared setAppliesImmediately:NO];
> myPrefs = [NSUserDefaults standardUserDefaults];
> [self readPrefs];
> }
>
> return self;
> }
This probably won't address your problem, but it's important.
--Kyle Sluder
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden