#import <Foundation/Foundation.h>
int main(int argc, const char * argv[])
{
@autoreleasepool {
//写配置文件
NSDictionary *glossary =
[NSDictionary dictionaryWithObjectsAndKeys:
@"A class defined",
@"Class",
@"A Function defined",
@"Function",
@"A Variable defined",
@"Variable",nil];
//写入
[NSKeyedArchiver archiveRootObject:glossary toFile:@"glossary.archive"];
//读取
NSDictionary *glossaryRead = [NSKeyedUnarchiver unarchiveObjectWithFile:@"glossary.archive"];
for( NSString *key in glossaryRead)
{
NSLog(@"%@:%@", key, [glossaryRead objectForKey:key]);
}
}
return 0;
}