Error Domain=NSURLErrorDomain Code=-1004 instead of -1009 in Swift service calls
问题 Generally, while performing GET or POST calls in iOS using dataTaskWithRequest or sendAsynchronousRequest we use to face network related errors with error codes like, NSURLErrorNotConnectedToInternet = -1009 NSURLErrorCannotConnectToHost = -1004 NSURLErrorTimedOut = -1001 In my case i'm disconnecting the internet and performing service calls. So, the expected error code is "NSURLErrorNotConnectedToInternet = -1009" . But, its throwing "NSURLErrorCannotConnectToHost = -1004" like below, Error