开发者

How to insert object already existing objects in NSMutableArray list

开发者 https://www.devze.com 2022-12-28 08:39 出处:网络
I am getting a problem, while inserting an object into the main List. [editContactList addObject:edi开发者_高级运维tcontacts];

I am getting a problem, while inserting an object into the main List.

[editContactList addObject:edi开发者_高级运维tcontacts];
[editObject.contactList insertObject:editContactList atIndex:0];//error as mutating method sent to immutable object
[editcontacts release];


If you get that particular error, you don't actually have an NSMutableArray; you have an NSArray. Which is immutable. (Note that simply casting an NSArray to NSMutableArray does nothing, the array itself needs to be an instance of a mutable array, rarely seen with instance variables, especially those made accessible publicly.)

Edit: We're going to need some more information; how are these variables defined, how are they initialized, etc.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号