• 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
NSURLErrorFailingURLErrorKey vs. NSURLErrorKey
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSURLErrorFailingURLErrorKey vs. NSURLErrorKey
      • From: "Quinn \"The Eskimo!\"" <email@hidden>
  • Prev by Date: Re: NSNetService advertises non-local IPv6 address in local domain
  • Next by Date: Re: NSURLErrorFailingURLErrorKey vs. NSURLErrorKey
  • Previous by thread: Re: NSNetService advertises non-local IPv6 address in local domain
  • Next by thread: Re: NSURLErrorFailingURLErrorKey vs. NSURLErrorKey
  • Index(es):
    • Date
    • Thread