• 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
Re: Subclassing NSMutableDictionary
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Subclassing NSMutableDictionary


  • Subject: Re: Subclassing NSMutableDictionary
  • From: Shawn Erickson <email@hidden>
  • Date: Tue, 29 Nov 2005 10:23:23 -0800

On 11/29/05, David Alter <email@hidden> wrote:

> - (id)init
> {
>      [super init];
>         NSMutableArray * children = [[NSMutableArray alloc] init];
>         [super setObject:children forKey:@"children"]; // I also tried doing
> this using "self" and not "super". It resulted in the same error
>      return self;
> }

Anyway just for completeness try the following (written in email so
not tested/compiled)...

- (id)init
{
    self = [super init];
    if (self != nil) {
        [self setObject:[[NSMutableArray alloc] init] forKey:@"children"];
    }
    return self;
}

Also looking at the code again I recommend against subclassing things
just to add members to it. Instead consider possibly adding a category
against NSMutableDictionary that implements a class method that
constructs a mutable dictionary with your mutable array keyed by
children or put that code in some controller as suggested by Idiot =P.
 _______________________________________________
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

  • Follow-Ups:
    • Re: Subclassing NSMutableDictionary
      • From: Guy English <email@hidden>
    • Re: Subclassing NSMutableDictionary
      • From: "I. Savant" <email@hidden>
References: 
 >Subclassing NSMutableDictionary (From: David Alter <email@hidden>)

  • Prev by Date: Re: Subclassing NSMutableDictionary
  • Next by Date: Re: Subclassing NSMutableDictionary
  • Previous by thread: Re: Subclassing NSMutableDictionary
  • Next by thread: Re: Subclassing NSMutableDictionary
  • Index(es):
    • Date
    • Thread