首页 > 其他 > 详细

mutating method sent to immutable object

时间:2015-03-24 23:14:07      阅读:363      评论:0      收藏:0      [点我收藏+]
if (commentArray==nil) {
                
commentArray = [[NSMutableArray allocinit];
            }
            
            
commentArray = (NSMutableArray*)[responseObject objectForKey:@"comment];

 *** Terminating app due to uncaught exception ‘NSInternalInconsistencyException‘, reason: ‘-[__NSCFArray insertObject:atIndex:]: mutating method sent to immutable object‘
*** First throw call stack:

一个不可变的数组调用了可变数组中的方法(添加/删除等)

  if (commentArray==nil) {
                commentArray = [[NSMutableArray alloc] init];
            }
           
           
NSArray *array = [responseObject objectForKey:@"comment"];
           
           
for (int i=0; i<array.count; i++) {
               
               
NSDictionary *dic = [array objectAtIndex:i];
                [
commentArray addObject:dic];
               
            }
           
            [
commentArray addObject:@"nihao"];



mutating method sent to immutable object

原文:http://blog.csdn.net/u010241322/article/details/44596083

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!