Re: Define NSError Domain
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