• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Problem with NSUserDefaultsController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Problem with NSUserDefaultsController
      • From: Mark Allan <email@hidden>
  • Prev by Date: Re: NSArray as a static
  • Next by Date: Re: QTCaptureConnectionEnabledAudioChannelsAttribute read only
  • Previous by thread: Re: Problem with NSUserDefaultsController
  • Next by thread: Re: Problem with NSUserDefaultsController
  • Index(es):
    • Date
    • Thread