Re: self = [super init], nil?
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