Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 03-02-2009, 08:50 PM   #5 (permalink)
BadgerDev
Registered Member
 
Join Date: Jan 2009
Posts: 18
BadgerDev is on a distinguished road
Default

Quote:
Originally Posted by RickMaddy View Post
A few things. First off, just register the defaults every time. They won't interfere with the real values.

Second, you can put boolean values in a dictionary that way.

Last, no need to synchronize the defaults. They won't get written anyway. They just act as a backup in case a key isn't found.

So your code should be:

Code:
NSDictionary *initDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithBool:NO], kPKey, @"Z", kFKey, [NSNumber numberWithBool:YES], kMKey, [NSNumber numberWithBool:NO], kCKey, [NSNumber numberWithBool:YES], kVKey, nil];

[myDefaults registerDefaults:initDefaults];
That's it. Just do this on app startup before you need to access anything from NSUserDefaults.
Beautiful! Worked like a charm--where do I send the royalty checks when my app hits the big time??? :-)

Thanks very much for your help--hopefully I can be of assistance to some folks here once I get the hang of this...have a good night.
BadgerDev is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,634
Threads: 94,095
Posts: 402,796
Top Poster: BrianSlick (7,990)
Welcome to our newest member, nyoe
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 09:10 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.