• 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: NSUserDefaultsController
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSUserDefaultsController


  • Subject: Re: NSUserDefaultsController
  • From: Scott Anguish <email@hidden>
  • Date: Sun, 9 Nov 2003 00:30:20 -0500

On Nov 8, 2003, at 11:03 PM, James Spencer wrote:

On Nov 8, 2003, at 4:04 PM, mmalcolm crawford wrote:

On Nov 8, 2003, at 1:05 PM, James Spencer wrote:
NSData * tempData = [[[NSUserDefaultsController sharedUserDefaultsController]
defaults] valueForKey:@"smtpServer"];
but what is returned is a data object and I can't figure out how to convert this object back into my NSString.

NSString * server = [[[NSUserDefaultsController sharedUserDefaultsController]
defaults] stringForKey:@"smtpServer"];

Thank you very much for this as it allows me to ask a more intelligent question, or at least I hope its more intelligent. This is what I initially tried. Unfortunately, what is being returned in server is nil. I've double checked the key, going to the extent of copying it and pasting it from Interface Builder and I know there is in fact a valid value in the defaults because when I quit the application and restart it, it is correctly putting the value into my Preferences window.


are you setting the initial values for the NSUserDefaultsController anywhere? I found that it had to be in a +initialize method that would get called early in the load. (like AppDelegate)
_______________________________________________
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.
  • Follow-Ups:
    • Re: NSUserDefaultsController
      • From: James Spencer <email@hidden>
References: 
 >NSUserDefaultsController (From: James Spencer <email@hidden>)
 >Re: NSUserDefaultsController (From: mmalcolm crawford <email@hidden>)
 >Re: NSUserDefaultsController (From: James Spencer <email@hidden>)

  • Prev by Date: Re: AltiVec programming? Mailing list?
  • Next by Date: NSTableView and NSPopUpButton
  • Previous by thread: Re: NSUserDefaultsController
  • Next by thread: Re: NSUserDefaultsController
  • Index(es):
    • Date
    • Thread