也许这是一个非常常见和书呆子的问题。我有一个 NSMutableDictionary,我正在向其中添加一些对象,然后将字典添加到 NSMutableArray。将字典添加到数组后,我将删除字典的所有对象并将其设置为 nil,这将从添加字典的数组中删除数据。我做错了什么导致数组丢失数据?
NSMutableDictionary *lDict = [[NSMutableDictionary alloc]init];
[lDict setObject:lDate forKey:@"date"];
[lDict setObject:presentationId forKey:@"pptId"];
[lDict setObject:presentationName forKey:@"PresentationName"];
[lDict setObject:presentationDesc forKey:@"PresentationDesc"];
[lDict setObject:presentationThumb forKey:@"presentationThumb"];
[lDict setObject:postCallRowId forKey:@"postCallId"];
[lDict setObject:userReaction forKey:@"userReaction"];
[lDict setObject:appDel.gRegion forKey:@"Region"];
[lDict setObject:@"Presentation" forKey:@"ContentType"];
[durationArray addObject:lDict];
//here I am having data in array
[lDict removeAllObjects];
lDict=nil;
//here I lost data in array also