I want to get error code that is 1009, I tried below code but getting value as zero
let err = error as NSError
switch URLError.Code(rawValue: err.code) {
case .notConnectedToInternet:
showAlertForNoInternetConnection()
default: break
}
but err.code value is zero, how can I parse to get 1009 Response :
Error Domain=kmh.hjui.www Code=0 "Network connection error, please check the network" UserInfo={statusCode=0, NSLocalizedDescription=Network connection error, please check the network, NSUnderlyingError=0x302c8c600 {Error Domain=NSURLErrorDomain Code=-1009 "The Internet connection appears to be offline." UserInfo={_kCFStreamErrorCodeKey=50, NSUnderlyingError=0x302c84ea0 {Error Domain=kCFErrorDomainCFNetwork Code=-1009 "(null)" UserInfo={_kCFStreamErrorDomainKey=1, _kCFStreamErrorCodeKey=50, _NSURLErrorNWResolutionReportKey=Resolved 0 endpoints in 0ms using unknown from cache, _NSURLErrorNWPathKey=unsatisfied (No network route), fallback: {generation: 0}}}, _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask`