Re: NSMutableArray is immutable when unarchived
Re: NSMutableArray is immutable when unarchived
- Subject: Re: NSMutableArray is immutable when unarchived
- From: nick briggs <email@hidden>
- Date: Fri, 15 Jul 2005 13:58:12 +0100
Well yes, [NSMutableArray array] is definitely mutable, else
[_triggers addObject:trigger] would fail...
... using [[NSMutableArray alloc] init] still produces the immutable
error :(
Not the behavior I'd expect, easy enough to work around, but why the
necessity for an ugly hack?
Nick
On 15 Jul 2005, at 13:47, SA Dev wrote:
Allow me to post a retraction ... this seems like it may not be
correct according to the docs: "+array Creates and returns an empty
array. This method is used by mutable subclasses of NSArray."
I'd personally still use _triggers = [[NSMutableArray alloc]
init]; which will work, but I might be wrong here in your situation.
Anybody??
On Jul 15, 2005, at 8:41 AM, SA Dev wrote:
Nick:
You're replacing your _triggers NSMutableArray with an NSArray
on init. :-)
[NSMutableArray array] returns an NSArray - immutable.
Try:
_triggers = [[NSMutableArray alloc] init];
On Jul 15, 2005, at 6:02 AM, nick briggs wrote:
- (id)initWithObject:(id)anObject
{
if(self = [super init])
{
...
_triggers = [[NSMutableArray array]retain];
...
}
return self;
}
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
40silentalcove.net
This email sent to email@hidden
_______________________________________________
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