Search code examples
iosios7ios8nserror

Different NSError localizedDescription between iOS 7 and 8


I was testing how my app displays erros when not connected to the internet and I noticed that iOS 7 and 8 return different error messages for NSURLErrorNotConnectedToInternet (-1009)

iOS 7 Error

Error Domain=NSURLErrorDomain
Code=-1009 "The Internet connection appears to be offline."
UserInfo=0x17d5edc0 {NSLocalizedDescription=The Internet connection appears to be offline., 
                     NSUnderlyingError=0x17ecdd20 "The Internet connection appears to be offline."}

iOS 8 error

Error Domain=NSURLErrorDomain
Code=-1009 "The operation couldn’t be completed. (NSURLErrorDomain error -1009.)"
UserInfo=0x1740f9c80 {_kCFStreamErrorDomainKey=12,
                      _kCFStreamErrorCodeKey=8,
                      NSUnderlyingError=0x17405dd90 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error -1009.)"}

Is there any way to have iOS generate an error message that would be the same on both iOS 7 and 8?


Solution

  • Use the code, it's the same.

    If they choosed to update the error message in iOS8, you can't do anything.