'''
NSError codes in the Cocoa error domain.
enum {
NSFileNoSuchFileError = 4,
NSFileLockingError = 255,
NSFileReadUnknownError = 256,
NSFileReadNoPermissionError = 257,
NSFileReadInvalidFileNameError = 258,
NSFileReadCorruptFileError = 259,
NSFileReadNoSuchFileError = 260,
NSFileReadInapplicableStringEncodingError = 261,
NSFileReadUnsupportedSchemeError = 262,
NSFileReadTooLargeError = 263,
NSFileReadUnknownStringEncodingError = 264,
NSFileWriteUnknownError = 512,
NSFileWriteNoPermissionError = 513,
NSFileWriteInvalidFileNameError = 514,
NSFileWriteInapplicableStringEncodingError = 517,
NSFileWriteUnsupportedSchemeError = 518,
NSFileWriteOutOfSpaceError = 640,
NSFileWriteVolumeReadOnlyError = 642m
NSKeyValueValidationError = 1024,
NSFormattingError = 2048,
NSUserCancelledError = 3072,
NSFileErrorMinimum = 0,
NSFileErrorMaximum = 1023,
NSValidationErrorMinimum = 1024,
NSValidationErrorMaximum = 2047,
NSFormattingErrorMinimum = 2048,
NSFormattingErrorMaximum = 2559,
NSPropertyListReadCorruptError = 3840,
NSPropertyListReadUnknownVersionError = 3841,
NSPropertyListReadStreamError = 3842,
NSPropertyListWriteStreamError = 3851,
NSPropertyListErrorMinimum = 3840,
NSPropertyListErrorMaximum = 4095
NSExecutableErrorMinimum = 3584,
NSExecutableNotLoadableError = 3584,
NSExecutableArchitectureMismatchError = 3585,
NSExecutableRuntimeMismatchError = 3586,
NSExecutableLoadError = 3587,
NSExecutableLinkError = 3588,
NSExecutableErrorMaximum = 3839,
}
URL Loading System Error Codes
These values are returned as the error code property of an NSError object with the domain “NSURLErrorDomain”.
typedef enum
{
NSURLErrorUnknown = -1,
NSURLErrorCancelled = -999,
NSURLErrorBadURL = -1000,
NSURLErrorTimedOut = -1001,
NSURLErrorUnsupportedURL = -1002,
NSURLErrorCannotFindHost = -1003,
NSURLErrorCannotConnectToHost = -1004,
NSURLErrorDataLengthExceedsMaximum = -1103,
NSURLErrorNetworkConnectionLost = -1005,
NSURLErrorDNSLookupFailed = -1006,
NSURLErrorHTTPTooManyRedirects = -1007,
NSURLErrorResourceUnavailable = -1008,
NSURLErrorNotConnectedToInternet = -1009,
NSURLErrorRedirectToNonExistentLocation = -1010,
NSURLErrorBadServerResponse = -1011,
NSURLErrorUserCancelledAuthentication = -1012,
NSURLErrorUserAuthenticationRequired = -1013,
NSURLErrorZeroByteResource = -1014,
NSURLErrorCannotDecodeRawData = -1015,
NSURLErrorCannotDecodeContentData = -1016,
NSURLErrorCannotParseResponse = -1017,
NSURLErrorFileDoesNotExist = -1100,
NSURLErrorFileIsDirectory = -1101,
NSURLErrorNoPermissionsToReadFile = -1102,
NSURLErrorSecureConnectionFailed = -1200,
NSURLErrorServerCertificateHasBadDate = -1201,
NSURLErrorServerCertificateUntrusted = -1202,
NSURLErrorServerCertificateHasUnknownRoot = -1203,
NSURLErrorServerCertificateNotYetValid = -1204,
NSURLErrorClientCertificateRejected = -1205,
NSURLErrorClientCertificateRequired = -1206,
NSURLErrorCannotLoadFromNetwork = -2000,
NSURLErrorCannotCreateFile = -3000,
NSURLErrorCannotOpenFile = -3001,
NSURLErrorCannotCloseFile = -3002,
NSURLErrorCannotWriteToFile = -3003,
NSURLErrorCannotRemoveFile = -3004,
NSURLErrorCannotMoveFile = -3005,
NSURLErrorDownloadDecodingFailedMidStream = -3006,
NSURLErrorDownloadDecodingFailedToComplete = -3007
}
有關(guān)于網(wǎng)絡(luò)請(qǐng)求失敗的解釋:
case -1://NSURLErrorUnknown
errorMesg = @"無效的URL地址";
break;
case -999://NSURLErrorCancelled
errorMesg = @"無效的URL地址";
break;
case -1000://NSURLErrorBadURL
errorMesg = @"無效的URL地址";
break;
case -1001://NSURLErrorTimedOut
errorMesg = @"網(wǎng)絡(luò)不給力,請(qǐng)稍后再試";
break;
case -1002://NSURLErrorUnsupportedURL
errorMesg = @"不支持的URL地址";
break;
case -1003://NSURLErrorCannotFindHost
errorMesg = @"找不到服務(wù)器";
break;
case -1004://NSURLErrorCannotConnectToHost
errorMesg = @"連接不上服務(wù)器";
break;
case -1103://NSURLErrorDataLengthExceedsMaximum
errorMesg = @"請(qǐng)求數(shù)據(jù)長(zhǎng)度超出最大限度";
break;
case -1005://NSURLErrorNetworkConnectionLost
errorMesg = @"網(wǎng)絡(luò)連接異常";
break;
case -1006://NSURLErrorDNSLookupFailed
errorMesg = @"DNS查詢失敗";
break;
case -1007://NSURLErrorHTTPTooManyRedirects
errorMesg = @"HTTP請(qǐng)求重定向";
break;
case -1008://NSURLErrorResourceUnavailable
errorMesg = @"資源不可用";
break;
case -1009://NSURLErrorNotConnectedToInternet
errorMesg = @"無網(wǎng)絡(luò)連接";
break;
case -1010://NSURLErrorRedirectToNonExistentLocation
errorMesg = @"重定向到不存在的位置";
break;
case -1011://NSURLErrorBadServerResponse
errorMesg = @"服務(wù)器響應(yīng)異常";
break;
case -1012://NSURLErrorUserCancelledAuthentication
errorMesg = @"用戶取消授權(quán)";
break;
case -1013://NSURLErrorUserAuthenticationRequired
errorMesg = @"需要用戶授權(quán)";
break;
case -1014://NSURLErrorZeroByteResource
errorMesg = @"零字節(jié)資源";
break;
case -1015://NSURLErrorCannotDecodeRawData
errorMesg = @"無法解碼原始數(shù)據(jù)";
break;
case -1016://NSURLErrorCannotDecodeContentData
errorMesg = @"無法解碼內(nèi)容數(shù)據(jù)";
break;
case -1017://NSURLErrorCannotParseResponse
errorMesg = @"無法解析響應(yīng)";
break;
case -1018://NSURLErrorInternationalRoamingOff
errorMesg = @"國(guó)際漫游關(guān)閉";
break;
case -1019://NSURLErrorCallIsActive
errorMesg = @"被叫激活";
break;
case -1020://NSURLErrorDataNotAllowed
errorMesg = @"數(shù)據(jù)不被允許";
break;
case -1021://NSURLErrorRequestBodyStreamExhausted
errorMesg = @"請(qǐng)求體";
break;
case -1100://NSURLErrorFileDoesNotExist
errorMesg = @"文件不存在";
break;
case -1101://NSURLErrorFileIsDirectory
errorMesg = @"文件是個(gè)目錄";
break;
case -1102://NSURLErrorNoPermissionsToReadFile
errorMesg = @"無讀取文件權(quán)限";
break;
case -1200://NSURLErrorSecureConnectionFailed
errorMesg = @"安全連接失敗";
break;
case -1201://NSURLErrorServerCertificateHasBadDate
errorMesg = @"服務(wù)器證書失效";
break;
case -1202://NSURLErrorServerCertificateUntrusted
errorMesg = @"不被信任的服務(wù)器證書";
break;
case -1203://NSURLErrorServerCertificateHasUnknownRoot
errorMesg = @"未知Root的服務(wù)器證書";
break;
case -1204://NSURLErrorServerCertificateNotYetValid
errorMesg = @"服務(wù)器證書未生效";
break;
case -1205://NSURLErrorClientCertificateRejected
errorMesg = @"客戶端證書被拒";
break;
case -1206://NSURLErrorClientCertificateRequired
errorMesg = @"需要客戶端證書";
break;
case -2000://NSURLErrorCannotLoadFromNetwork
errorMesg = @"無法從網(wǎng)絡(luò)獲取";
break;
case -3000://NSURLErrorCannotCreateFile
errorMesg = @"無法創(chuàng)建文件";
break;
case -3001://? NSURLErrorCannotOpenFile
errorMesg = @"無法打開文件";
break;
case -3002://NSURLErrorCannotCloseFile
errorMesg = @"無法關(guān)閉文件";
break;
case -3003://NSURLErrorCannotWriteToFile
errorMesg = @"無法寫入文件";
break;
case -3004://NSURLErrorCannotRemoveFile
errorMesg = @"無法刪除文件";
break;
case -3005://NSURLErrorCannotMoveFile
errorMesg = @"無法移動(dòng)文件";
break;
case -3006://NSURLErrorDownloadDecodingFailedMidStream
errorMesg = @"下載解碼數(shù)據(jù)失敗";
break;
case -3007://NSURLErrorDownloadDecodingFailedToComplete
errorMesg = @"下載解碼數(shù)據(jù)失敗";
break;
作者:沫雨微涼
鏈接:http://www.reibang.com/p/118a864c8c68
來源:簡(jiǎn)書
著作權(quán)歸作者所有志鞍。商業(yè)轉(zhuǎn)載請(qǐng)聯(lián)系作者獲得授權(quán)方仿,非商業(yè)轉(zhuǎn)載請(qǐng)注明出處。