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

Re: self = [super init], nil?


  • Subject: Re: self = [super init], nil?
  • From: jeremy <email@hidden>
  • Date: Sat, 08 May 2010 11:27:08 -0400

On May 7, 2010, at 2:34 PM, Patrick M. Rutkowski wrote:

> it worth checking for nil after doing self = [super init]?


Yes. It's part of a design pattern, which looks like this:

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

   }
   return self;
}
---

See "Constraints and Conventions".
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#//apple_ref/doc/uid/TP30001163-CH22-SW14

Also see "Handling Initialization Failure".
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/Articles/ocAllocInit.html#//apple_ref/doc/uid/TP30001163-CH22-SW13
_______________________________________________

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: self = [super init], nil?
      • From: Scott Anguish <email@hidden>
References: 
 >self = [super init], nil? (From: "Patrick M. Rutkowski" <email@hidden>)

  • Prev by Date: Re: self = [super init], nil?
  • Next by Date: Re: self = [super init], nil?
  • Previous by thread: Re: self = [super init], nil?
  • Next by thread: Re: self = [super init], nil?
  • Index(es):
    • Date
    • Thread