Advertise here




Advertise here

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

NSUserDefaults: How to know if a value does not exist?

rocotilosrocotilos Posts: 3,287iPhone Dev SDK Supporter, Registered Users @ @ @ @ @
edited November 2010 in iPhone SDK Development
Hi Guys and Gals,

I am saving some user settings using NSUserDefaults.

in viewdidload, I retrieve the settings, and apply. Now, if it is a first installation, then this setting does not exist. So, how to check if a setting exist or not?

I am using this code
int FCOLOR = [[NSUderDefaults standardUserDefaults] integerForKey:@"MyColor"];

Is there a way to detect if "MyColor" exist or not? Or I just have to manually check for the value (valid or nonvalid)?

Ta. Cheers.
Post edited by rocotilos on

Replies

Sign In or Register to comment.