由于dic中value有null,所以无法直接执行writeToFile,需要先进行归档才可以操作。
- (BOOL)storageAreasFileWith:(NSDictionary *)dict {
NSString *areasPath = [[NSFileManager documentsPath] stringByAppendingPathComponent:@"areas.plist"];
NSData * data = [NSKeyedArchiver archivedDataWithRootObject:dict];
return [data writeToFile:areasPath atomically:YES];
}
- (NSArray *)outPutAreasDictionary {
NSString *areasPath = [[NSFileManager documentsPath] stringByAppendingPathComponent:@"areas.plist"];
NSData * data = [NSData dataWithContentsOfFile:areasPath];
return [NSKeyedUnarchiver unarchiveObjectWithData:data];
}