网络请求失败NSError不同状态下的提示语

#define NetWorkErroPlaceHoldText        if (error.code == NSURLErrorUnknown) {\
[SVProgressHUD showErrorWithStatus:@"无效的url地址"];\
}else if (error.code == NSURLErrorCancelled){\
    [SVProgressHUD showErrorWithStatus:@"无效的url地址"];\
}else if (error.code == NSURLErrorBadURL){\
    [SVProgressHUD showErrorWithStatus:@"无效的url地址"];\
}else if (error.code == NSURLErrorTimedOut){\
    [SVProgressHUD showErrorWithStatus:@"网络不给力,请稍后再试"];\
}else if (error.code == NSURLErrorUnsupportedURL){\
    [SVProgressHUD showErrorWithStatus:@"不支持的URL地址"];\
}else if (error.code == NSURLErrorCannotConnectToHost){\
    [SVProgressHUD showErrorWithStatus:@"连接不上服务器"];\
}else if (error.code == NSURLErrorDataLengthExceedsMaximum){\
    [SVProgressHUD showErrorWithStatus:@"请求数据长度超出最大限度"];\
}else if (error.code == NSURLErrorNetworkConnectionLost){\
    [SVProgressHUD showErrorWithStatus:@"网络连接异常"];\
}else if (error.code == NSURLErrorDNSLookupFailed){\
    [SVProgressHUD showErrorWithStatus:@"DNS查询失败"];\
}else if (error.code == NSURLErrorHTTPTooManyRedirects){\
    [SVProgressHUD showErrorWithStatus:@"HTTP请求重定向"];\
}else if (error.code == NSURLErrorResourceUnavailable){\
    [SVProgressHUD showErrorWithStatus:@"资源不可用"];\
}else if (error.code == NSURLErrorNotConnectedToInternet){\
    [SVProgressHUD showErrorWithStatus:@"无网络连接"];\
}else if (error.code == NSURLErrorRedirectToNonExistentLocation){\
    [SVProgressHUD showErrorWithStatus:@"重定向到不存在的位置"];\
}else if (error.code == NSURLErrorBadServerResponse){\
    [SVProgressHUD showErrorWithStatus:@"服务器响应异常"];\
}else if (error.code == NSURLErrorUserCancelledAuthentication){\
    [SVProgressHUD showErrorWithStatus:@"用户取消授权"];\
}else if (error.code == NSURLErrorUserAuthenticationRequired){\
    [SVProgressHUD showErrorWithStatus:@"需要用户授权"];\
}else if (error.code == NSURLErrorZeroByteResource){\
    [SVProgressHUD showErrorWithStatus:@"零字节资源"];\
}else if (error.code == NSURLErrorCannotDecodeRawData){\
    [SVProgressHUD showErrorWithStatus:@"无法解码原始数据"];\
}else if (error.code == NSURLErrorCannotDecodeContentData){\
    [SVProgressHUD showErrorWithStatus:@"无法解码内容数据"];\
}else if (error.code == NSURLErrorCannotParseResponse){\
    [SVProgressHUD showErrorWithStatus:@"无法解析响应"];\
}else if (error.code == NSURLErrorInternationalRoamingOff){\
    [SVProgressHUD showErrorWithStatus:@"国际漫游关闭"];\
}else if (error.code == NSURLErrorCallIsActive){\
    [SVProgressHUD showErrorWithStatus:@"被叫激活"];\
}else if (error.code == NSURLErrorRequestBodyStreamExhausted){\
    [SVProgressHUD showErrorWithStatus:@"请求体错误"];\
}else if (error.code == NSURLErrorFileDoesNotExist){\
    [SVProgressHUD showErrorWithStatus:@"文件不存在"];\
}else if (error.code == NSURLErrorFileIsDirectory){\
    [SVProgressHUD showErrorWithStatus:@"文件是个目录"];\
}else if (error.code == NSURLErrorNoPermissionsToReadFile){\
    [SVProgressHUD showErrorWithStatus:@"无读取文件权限"];\
}else if (error.code == NSURLErrorSecureConnectionFailed){\
    [SVProgressHUD showErrorWithStatus:@"安全连接失败"];\
}else if (error.code == NSURLErrorServerCertificateHasBadDate){\
    [SVProgressHUD showErrorWithStatus:@"服务器证书失效"];\
}else if (error.code == NSURLErrorServerCertificateUntrusted){\
    [SVProgressHUD showErrorWithStatus:@"不被信任的服务器证书"];\
}else if (error.code == NSURLErrorServerCertificateHasUnknownRoot){\
    [SVProgressHUD showErrorWithStatus:@"未知Root的服务器证书"];\
}else if (error.code == NSURLErrorServerCertificateNotYetValid){\
    [SVProgressHUD showErrorWithStatus:@"服务器证书未生效"];\
}else if (error.code == NSURLErrorClientCertificateRejected){\
    [SVProgressHUD showErrorWithStatus:@"客户端证书被拒绝"];\
}else if (error.code == NSURLErrorClientCertificateRequired){\
    [SVProgressHUD showErrorWithStatus:@"需要客户端证书"];\
}else if (error.code == NSURLErrorCannotLoadFromNetwork){\
    [SVProgressHUD showErrorWithStatus:@"无法从网络获取"];\
}else if (error.code == NSURLErrorCannotCreateFile){\
    [SVProgressHUD showErrorWithStatus:@"无法创建文件"];\
}else if (error.code == NSURLErrorCannotOpenFile){\
    [SVProgressHUD showErrorWithStatus:@"无法打开文件"];\
}else if (error.code == NSURLErrorCannotCloseFile){\
    [SVProgressHUD showErrorWithStatus:@"无法关闭文件"];\
}else if (error.code == NSURLErrorCannotWriteToFile){\
    [SVProgressHUD showErrorWithStatus:@"无法写入文件"];\
}else if (error.code == NSURLErrorCannotRemoveFile){\
    [SVProgressHUD showErrorWithStatus:@"无法删除文件"];\
}else if (error.code == NSURLErrorCannotMoveFile){\
    [SVProgressHUD showErrorWithStatus:@"无法移动文件"];\
}else if (error.code == NSURLErrorDownloadDecodingFailedMidStream){\
    [SVProgressHUD showErrorWithStatus:@"下载解码数据失败"];\
}else if (error.code == NSURLErrorDownloadDecodingFailedToComplete){\
    [SVProgressHUD showErrorWithStatus:@"下载解码数据失败"];\
}else{\
    [SVProgressHUD showErrorWithStatus:@"服务器异常"];\
}

你可能感兴趣的:(网络请求失败NSError不同状态下的提示语)