Friday, 25 January 2013

Storing and Retrieving Setting Values

Some times it is required to store few setting of the application. The .NET programming world in Windows, setting can be used for this purpose. In Objective C, NSUserDefaults is used for this purpose. It is very simple and straight forward.
To store a setting value:

And to retrieve stored setting:
Please also note that in case of retrieving a value which is not stored, ValueForKey returns Null (nil in Objective C) and thus, calling .ToString() method, causes an exception.