• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Initialising NSMutableArray
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Initialising NSMutableArray


  • Subject: Initialising NSMutableArray
  • From: DKJ <email@hidden>
  • Date: Mon, 13 Jul 2009 08:44:47 -0700

I've subclassed an NSMutableArray, and I want it to be initialised with some objects already in place. So I did this:

- (id) init
{
	self = [super init];
	if (self != nil) {

		for( int i = 0; i < 3; i++ )
			[self addObject:[[[myClass alloc] init] autorelease]];
	}
	return self;
}

But this produces an NSInvalidArgumentException, with the message:

[NSMutableArray addObject:]: method only defined for abstract class.

I suspect I'm missing something simple here.

dkj
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Initialising NSMutableArray
      • From: "David W. Berry" <email@hidden>
    • Re: Initialising NSMutableArray
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: NSCondition (unlocked when not locked)
  • Next by Date: Re: Best 'Cocoa' File Preview
  • Previous by thread: Re: Quickly jump to a particular symbol/selector/class ?
  • Next by thread: Re: Initialising NSMutableArray
  • Index(es):
    • Date
    • Thread