• 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
exception in init
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

exception in init


  • Subject: exception in init
  • From: Ariel Feinerman <email@hidden>
  • Date: Wed, 04 Apr 2012 15:38:32 +0400

Hi,

I think the question was asked and answered but I cannot see a clearance
what is the right way to write init in the cases the arguments are nil or
wrong?
Returning a nil or raising an exception?

- (id) initWithURL: (NSURL *) url {


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

if (!url) {

// ?

}

 if (![url isFileURL]) {

// ?

}

}

 return self;

}

I can frequently see the following in init

NSAssert(url, @"url may not be nil", );

--
best regards
Ariel
_______________________________________________

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: exception in init
      • From: Dave <email@hidden>
    • Re: exception in init
      • From: Corbin Dunn <email@hidden>
    • Re: exception in init
      • From: Jens Alfke <email@hidden>
    • Re: exception in init
      • From: Andreas Grosam <email@hidden>
  • Prev by Date: Re: Core Data Automatic Lightweight Migration
  • Next by Date: Re: exception in init
  • Previous by thread: Re: Using NSView fullscreen mode vs. autolayout constraints
  • Next by thread: Re: exception in init
  • Index(es):
    • Date
    • Thread