NSUserDefaults always returns 0, in Simulator and Device
Posted
by joec
on Stack Overflow
See other posts from Stack Overflow
or by joec
Published on 2010-04-13T22:26:47Z
Indexed on
2010/04/13
22:33 UTC
Read the original article
Hit count: 527
I have a settings bundle in my iPhone app, with the following PList:
Type: PSMultiValueSpecifier
Title: Within (Kilometres)
DefaultValue: Number: 1
Titles: Array:
Item 1: Number: 1
Item 2: Number: 2
Values: Array:
Item 1: Number: 1
Item 2: Number: 2
Key: String: km
Then in my code i have:
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSInteger choiceOne = [defaults integerForKey:@"km"];
choiceOne
is always 0.
What am i doing wrong?
Thanks
© Stack Overflow or respective owner