• 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: new class
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new class


  • Subject: Re: new class
  • From: Erik Buck <email@hidden>
  • Date: Fri, 21 Sep 2007 07:16:22 -0700 (PDT)

  You retain an object when you want to have reference to it later. For
example, to set an ivar you do something like this:

- (void)setString:(NSString*)string
{
  [_string release];
  _string = [string retain];
}

  Please don't re-state Cocoa's memory management conventions unless you are prepared to do it correctly.  It is much more efficient to simply provide a link to Apple's documentation and avoid littering this forum with bad or incorrect advice such as your broken sample code.

  Simply stated Cocoa Memory Management Rules
  http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Tasks/MemoryManagementRules.html

  Introduction to Memory Management (not Cocoa specific):
  http://developer.apple.com/documentation/mac/Memory/Memory-9.html

  Basic Cocoa Accessor Methods:
  http://developer.apple.com/documentation/Cocoa/Conceptual/ModelObjects/Articles/moAccessorMethods.html#//apple_ref/doc/uid/TP40002132-SW1
  http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/AddingBehaviortoaCocoaProgram/chapter_4_section_5.html#//apple_ref/doc/uid/TP40002974-CH5-SW5

  Search for more...

_______________________________________________

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

  • Prev by Date: Need help with -mutableSetValueForKey:
  • Next by Date: Re: UI Effects
  • Previous by thread: Re: new class
  • Next by thread: NSImage information
  • Index(es):
    • Date
    • Thread