Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Programmer

macrumors member
Original poster
Jun 16, 2009
79
0
i have been trying to declare an NSUserdefualt in my app for a few hours and i am starting to get really frustrated. How do you set the NSUserdefualt up?
 
instead of writing something like the following several times in methods throughout a class:
Code:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

you could simply define it at the beginning of your class:
Code:
#define kDefaults [NSUserDefaults standardUserDefaults]
 
instead of writing something like the following several times in methods throughout a class:
Code:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];

you could simply define it at the beginning of your class:
Code:
#define kDefaults [NSUserDefaults standardUserDefaults]

True, I don't like using constants like that though :)

Personal choice though.
 
but...

but how do declare the stuff you want to set as your NSUserdefault
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.