Re: Mutating method sent to immutable object
Re: Mutating method sent to immutable object
- Subject: Re: Mutating method sent to immutable object
- From: Scott Stevenson <email@hidden>
- Date: Sun, 10 Oct 2004 18:53:04 -0700
On Oct 10, 2004, at 6:51 PM, Scott Stevenson wrote:
- (void)setExtraDataArray:(NSMutableArray *)newExtraDataArray {
if (extraDataArray != newExtraDataArray) {
[extraDataArray release];
extraDataArray = [newExtraDataArray copy];
}
}
And the array is initialized using:
[self setExtraDataArray:[NSMutableArray arrayWithCapacity:20]];
The problem is that -copy returns an immutable instance.
Sorry, should have also mentioned that replacing -copy with
-mutableCopy should resolve this.
- Scott
--
http://treehouseideas.com/
http://theobroma.treehouseideas.com/ [blog]
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden