• 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: On self = [super init...] ...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: On self = [super init...] ...


  • Subject: Re: On self = [super init...] ...
  • From: Bill Bumgarner <email@hidden>
  • Date: Thu, 18 Nov 2010 18:37:07 -0800

On Nov 18, 2010, at 2:34 PM, John Engelhart wrote:

> method is just going to -dealloc my object and do something else (you know, basically exactly what I'm trying to do with my own object substitution, hint hint), then what's the point in even trying to do object substitution in the first place?

The documentation says:

		In general, if there is a problem during an initialization method, you should call [self release]and return nil.
Thus, no, there is no problem if multiple classes in the hierarchy participate.    The only stumbling point is that this:

		self = [super init];

May cause 'self' to be released;   if you have code that is still referring to self via some other means, it better had darned well retained it before making that call.

b.bum

_______________________________________________

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

References: 
 >Re: On self = [super init...] ... (From: Bill Bumgarner <email@hidden>)
 >Re: On self = [super init...] ... (From: John Engelhart <email@hidden>)

  • Prev by Date: NSScroller trackKnob
  • Next by Date: Re: NSScroller trackKnob
  • Previous by thread: Re: On self = [super init...] ...
  • Next by thread: Calling a class method with the runtime ObjC API
  • Index(es):
    • Date
    • Thread