• 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: [iOS] NSUserDefaults best practices
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [iOS] NSUserDefaults best practices


  • Subject: Re: [iOS] NSUserDefaults best practices
  • From: Jerry Krinock <email@hidden>
  • Date: Sat, 5 Feb 2011 13:57:30 -0800

On 2011 Feb 05, at 12:24, Chris Parker wrote:

> Usually, you construct a dictionary plist in your application bundle which contains the key/value pairs you wish to use as your "backstop" defaults.

I call them "default defaults".

> Then, you can read that dictionary from the plist in the bundle on launch and call [[NSUserDefaults standardUserDefaults] registerDefaults:]. This sets up the key/value pairs in the registration domain.

NSString* ddPath = [[NSBundle mainBundle] pathForResource:@"DefaultDefaults"
                                                   ofType:@"plist"] ;
NSDictionary* defaultDefaults = [NSDictionary dictionaryWithContentsOfFile:ddPath] ;
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultDefaults] ;

_______________________________________________

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

References: 
 >[iOS] NSUserDefaults best practices (From: Philip Vallone <email@hidden>)
 >Re: [iOS] NSUserDefaults best practices (From: Chris Parker <email@hidden>)

  • Prev by Date: Re: [iOS] NSUserDefaults best practices
  • Next by Date: Re: [iOS] NSUserDefaults best practices
  • Previous by thread: Re: [iOS] NSUserDefaults best practices
  • Next by thread: Re: [iOS] NSUserDefaults best practices
  • Index(es):
    • Date
    • Thread