views:

133

answers:

1

While replacing or inserting into an NSMutable array, I am getting exception as:

Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '* -[NSCFArray replaceObjectAtIndex:withObject:]: mutating method sent to immutable object'

[list replaceObjectAtIndex:indexRow withObject:editcontacts]; //or

[list insertObject:editcontacts atIndex:indexRow];

+2  A: 

You are still using an NSArray instead of an NSMutableArray. You need to allocate list as such:

NSMutableArray *list = [[NSMutableArray alloc] init];

See this question

Williham Totland