Created
June 18, 2011 05:04
-
-
Save rabinjoshi/1032821 to your computer and use it in GitHub Desktop.
Archiving objects
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSDictionary *glossary = [NSDictionary dictionaryWithObjectsAndKeys: | |
@"A class defined so other classes can inherit from it.", @"abstract class", | |
@"To implement all the methods defined in a protocol", @"adopt", | |
@"Storing an object for later use. ", @"archiving", | |
nil | |
]; | |
// Storing | |
if ([glossary writeToFile: @"/Users/rabinjoshi/Desktop/glossary.plist" atomically: YES] == NO) | |
NSLog (@"Save to file failed!"); | |
// Retrieving | |
NSDictionary *glossary2; | |
glossary2 = [NSDictionary dictionaryWithContentsOfFile: @"/Users/rabinjoshi/Desktop/glossary.plist"]; | |
for ( NSString *key in glossary ) | |
NSLog (@"%@: %@", key, [glossary2 objectForKey: key]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment