NSURLErrorFailingURLErrorKey vs. NSURLErrorKey
NSURLErrorFailingURLErrorKey vs. NSURLErrorKey
- Subject: NSURLErrorFailingURLErrorKey vs. NSURLErrorKey
- From: Jens Alfke <email@hidden>
- Date: Tue, 05 Apr 2016 11:56:44 -0700
{I posted this to cocoa-dev last month but there wasn’t any definitive answer. Asking here since CFNetwork is what’s producing CF/NSErrors with the NSURLErrorFailingURLErrorKey.}
So, NSError.h declares NSURLErrorKey, as a userInfo key for the URL associated with the error.
And NSURLError.h declares NSURLErrorFailingURLErrorKey, which appears to have the same purpose.
Neither of these is deprecated, although there’s yet another constant (NSErrorFailingURLStringKey) that is.
What’s the difference between these? If I’m creating an NSError for some kind of network-related error, using my own custom error domain, and adding a URL to it to indicate the source of the error, which one is preferred?
(Before you answer “It’s your app, you can put whatever you want in your own errors” — I work on a framework, not an app, so the NSErrors I produce will be consumed by other people's apps, and I want them to conform to best practices so as not to confuse/annoy developers.)
—Jens
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden