• 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: Define NSError Domain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Define NSError Domain


  • Subject: Re: Define NSError Domain
  • From: Sherm Pendley <email@hidden>
  • Date: Fri, 23 Sep 2005 20:55:06 -0400

On Sep 23, 2005, at 8:18 PM, Johan Kool wrote:

Thanks for your reply Andreas. I understand how to create an NSError
with a domain. What I don't understand is how I define my own domain.
Say I want to have the domain JKMyErrorDomain with my own error codes
in it. How do I define that?

I don't understand the question. What do you mean by "define"?

You could use a string literal, like so:

    NSError *err = [NSError errorWithDomain:@"JKMyErrorDomain" ...];

You could define & declare a global constant. You'd declare it in a .h file like this:

    extern NSString *const JKMyErrorDomain;

Then you'd define it in an .m file like this:

    NSString *const JKMyErrorDomain = @"JKMyErrorDomain";

Are you asking what value to assign to it? It's supposed to be based on your internet domain, backwards. So mine, for instance, would be "org.dot-app.AppName", and Andreas' would be "de.harmless.AppName".

sherm--

Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Define NSError Domain
      • From: Johan Kool <email@hidden>
References: 
 >Define NSError Domain (From: Johan Kool <email@hidden>)
 >Re: Define NSError Domain (From: Andreas Mayer <email@hidden>)
 >Re: Define NSError Domain (From: Johan Kool <email@hidden>)

  • Prev by Date: Re: Vertically centre text in Table Views
  • Next by Date: Re: Define NSError Domain
  • Previous by thread: Re: Define NSError Domain
  • Next by thread: Re: Define NSError Domain
  • Index(es):
    • Date
    • Thread