How to handle "mutating method sent to immutable object" exception?
Posted
by Madan Mohan
on Stack Overflow
See other posts from Stack Overflow
or by Madan Mohan
Published on 2010-04-28T11:05:01Z
Indexed on
2010/04/28
11:13 UTC
Read the original article
Hit count: 465
objective-c
|iphone
I am having a class called Customer.
Customer *object; //in this object i have the following data varialbles.
object.customerName
object.customerAddress
object.customerContactList
I declared customerContactList as NSMutableArray and also allocated and initialized.
Now I am adding or deleting from contactList.
//Adding.
[object.customerContactList addObject:editcontacts];// here editcontacts one of the object in contactList.
//Deleting.
[object.customerContactList removeObjectAtIndex:indexPath.row];
[theTableView deleteSections:[NSIndexSet indexSetWithIndex:indexPath.section] withRowAnimation:UITableViewRowAnimationFade];
I am getting exception even it is NSMutableArray. Please help me.
Thank You, Madan Mohan
© Stack Overflow or respective owner