Using NSUserDefaults is great when you want to save small amounts of application data such as log in, last settings, etc An Example Saving NSUserDefaults *NonVolatile = [NSUserDefaults standardUserDefaults]; [NonVolatile setObject:@”TextToSave” forKey:@”keyToLookupString”]; //Saving an NSString [NonVolatile setInteger:42 forKey:@”integerKey”]; //Saving an NSInteger [NonVolatile setBool:YES forKey:@”boolKey”]; //Saving a BOOL [NonVolatile setDouble:3.1415 forKey:@”doubleKey”]; //saving a Double [NonVolatile setFloat:1.2345678 forKey:@”floatKey”]; […]
Category: Non Volatile Memory
Using Archiving
When a class conforms to the NSCoding protocol it can be archived and later loaded into the application. Archiving is very simple to use. To make a class suitable for archiving you simply need to use the NSCoding delegate and implement the encodeWithEncoder and initWithEncoder funcitons. The class is then ready to be stored and […]