• 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: object instance names generated on the fly?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: object instance names generated on the fly?


  • Subject: Re: object instance names generated on the fly?
  • From: mmalcolm crawford <email@hidden>
  • Date: Sat, 22 Mar 2003 22:40:05 -0800

On Saturday, March 22, 2003, at 08:51 AM, Dr. H. Nikolaus Schaller wrote:
NSMutableDictionary *dict=[NSMutableDictionary dictionaryWithCapacity:10];

to add a new instance of your object:

[dict setObject:[[yourClass alloc] init] forKey:yourKey];
[...]
Note that the NSMutableDictionary keeps care of all retains&releases.

Umm, not in your example it doesn't. You'd need either:

[dict setObject:[[[yourClass alloc] init] autorelease] forKey:yourKey];

or:

YourClass *yc = [[YourClass alloc] init];
[dict setObject:yc forKey:yourKey];
[yc release];

mmalc
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: object instance names generated on the fly? (From: "Dr. H. Nikolaus Schaller" <email@hidden>)

  • Prev by Date: Re: Is it a bug in the AppKit code or a lack of clear explanation in the documentation of NSOpenPanel?
  • Next by Date: Re: my previous message about IBOutlet and IBAction
  • Previous by thread: Re: object instance names generated on the fly?
  • Next by thread: Re: object instance names generated on the fly?
  • Index(es):
    • Date
    • Thread