NSArray *array = [NSArray arrayWithObjects:@"one", @"two", @"three", nil];
NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent:@"data"];
//多對象歸檔
NSMutableData *data = [NSMutableData data];
// NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:data];
// [archiver encodeObject:array forKey:@"array"];
// [archiver encodeObject:@12 forKey:@"age"];
// [archiver encodeObject:@"hh" forKey:@"name"];
// [archiver finishEncoding];
// [data writeToFile:filePath atomically:YES];
//多對象解檔
NSMutableData * getData = [[NSMutableData alloc] initWithContentsOfFile:filePath];
NSKeyedUnarchiver * unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:getData];
NSLog(@"%@",[unarchiver decodeObjectForKey:@"array"]);