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解决方法 这样的事情怎么样:
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"];//make a new dictionary and save it[durationArray addobject:[[NSDictionary alloc] initWithDictionary:lDict]];[lDict removeAllObjects];lDict=nil;
在从可变字典中删除所有对象之前,请创建具有相同内容的新字典并将其保存到数组中.
通过创建新词典,您仍然可以在原始词典中维护键/值对设置,而不仅仅是保存值.
总结以上是内存溢出为你收集整理的ios – 从NSMutableDictionary中删除所有数据全部内容,希望文章能够帮你解决ios – 从NSMutableDictionary中删除所有数据所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)