In Apple's Concepts in Objective-C Programming discussing Issues with 
Initializers there is this code snippet

id anObject = [[MyClass alloc] init];
if (anObject) {
   [anObject doSOmething];
   // more messages…
} else {
  // handle error
}

All the code I Googled does not address the nil case in an error handling way. 
What one sees is mostly just returning nil.

In the interest of writing correct code I am curious to know the norm for 
handling such an error? 

Use NSAssert and/or assert and friends? 
Just log it? 
Put up a Dialog ?

TIA for your thoughts.

Peter

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to