在这段代码中,我选择了一个字典,将其修改并保存在另一个数组中。但我不知道为什么在代码的第二行,即插入的位置它崩溃的字典(发送到释放实例消息)我。如何才能解决这个将对象插入到数组中时崩溃
NSArray *array=[NSArray arrayWithContentsOfFile:plistPath];
NSLog(@"array before %@",array);
NSMutableArray *tempArray=[[NSMutableArray alloc]init];
tempArray=(NSMutableArray*)array;
NSMutableDictionary *dictToBeChanged=[[NSMutableDictionary alloc]init];
dictToBeChanged=[tempArray objectAtIndex:indexPath.row];
[dictToBeChanged setObject:[NSNumber numberWithBool:YES] forKey:@"isPaid"];
[tempArray removeObjectAtIndex:indexPath.row];
[tempArray insertObject:dictToBeChanged atIndex:indexPath.row];
NSLog(@"array after %@",tempArray);