2
我需要将数据从2个数组保存到文档目录,第一个保存,但第二个不是!将NSArray数据保存到NSDocumentDirectory中的2个文件中
- (void)viewWillDisappear:(BOOL)animated
{
[super viewWillDisappear:animated];
NSString *documentsDir = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];
NSString *rangePath = [documentsDir stringByAppendingPathComponent:@"Range.plist"];
NSString *indexPath = [documentsDir stringByAppendingPathComponent:@"Select.plist"];
[finalMutable writeToFile:rangePath atomically:YES];
[finalIndex writeToFile:indexPath atomically:YES];
}
更新:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[finalIndex addObject:[NSIndexPath indexPathForRow:indexPath.row inSection:indexPath.section]];
}
PLS添加什么finalMutable和finalIndex包含,finalIndex一定是问题 –
它们都有相同的,这是NSLog:finalMutable count:5,finalIndex count:5 –