在這段代碼中,我選擇了一個字典,將其修改並保存在另一個數組中。但我不知道爲什麼在代碼的第二行,即插入的位置它崩潰的字典(發送到釋放實例消息)我。如何才能解決這個將對象插入到數組中時崩潰
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);