NSURLSession does not provide user readable error descriptions like NSURLConnection does.
| Originator: | brian.nickel | ||
| Number: | rdar://19349504 | Date Originated: | 26-Dec-2014 12:37 PM |
| Status: | Duplicate of 18176157 | Resolved: | |
| Product: | iOS SDK | Product Version: | |
| Classification: | Reproducible: |
Summary: When an error occurs in NSURLConnection, the NSLocalizedDescriptionKey user data is set with a meaningful error message, like "A server with the specified hostname could not be found." NSURLSession errors on the other hand do not have this key set and return messages that should not be displayed to the user: The operation couldn’t be completed. (NSURLErrorDomain error -1003.) Steps to Reproduce: Run the attached swift script with /usr/bin/swift Expected Results: Both programs return the same error message: Good error -1003 from NSURLConnection: A server with the specified hostname could not be found. Bad error -1003 from NSURLSession: A server with the specified hostname could not be found. Actual Results: Good error -1003 from NSURLConnection: A server with the specified hostname could not be found. Bad error -1003 from NSURLSession: The operation couldn’t be completed. (NSURLErrorDomain error -1003.) Version: iOS 8, Yosemite Notes: Configuration: iPhone 6, Mac Book Pro, iOS Simulator Attachments: https://gist.github.com/bnickel/b8752e36ecc256178e91
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!