NSMutableArray 是否支持递归序列化?例如,当调用 writeToFile 时,NSMutableArray 的 NSMutableArray 会序列化整个层次结构吗?
例子:
NSMutableArray *topArray = [[NSMutableArray alloc] init];
NSMutableArray *bottomArray = [[NSMutableArray alloc] init];
NSString *foo = @"foo";
NSString *bar = @"bar";
NSString *bar2 = @"bar2";
[topArray addObject:foo];
[topArray addObject:bottomArray];
[bottomArray addObject:bar];
[bottomArray addObject:bar2];
[topArray writeToFile:validFilePath atomically:YES];
我在问,因为我有 3 个字符串值和一个 NSMutableArray 的 NSData 对象,我想将它们填充到父 NSMutableArray 中并序列化到一个文件中,然后在以后重新组合。如果可能的话,我想在不编写自己的 NSCoder 实现的情况下做到这一点,采取简单的方法。
谢谢。