NSError Codes
所属库文件:Foundation/FoundationErrors.h
NS_ERROR_ENUM(NSCocoaErrorDomain) {
// File system and file I/O related errors, with NSFilePathErrorKey or NSURLErrorKey containing path or URL
NSFileNoSuchFileError = 4, // Attempt to do a file system operation on a non-existent file
NSFileLockingError = 255, // Couldn't get a lock on file
NSFileReadUnknownError = 256, // Read error (reason unknown)
NSFileReadNoPermissionError = 257, // Read error (permission problem)
NSFileReadInvalidFileNameError = 258, // Read error (invalid file name)
NSFileReadCorruptFileError = 259, // Read error (file corrupt, bad format, etc)
NSFileReadNoSuchFileError = 260, // Read error (no such file)
NSFileReadInapplicableStringEncodingError = 261, // Read error (string encoding not applicable) also NSStringEncodingErrorKey
NSFileReadUnsupportedSchemeError = 262, // Read error (unsupported URL scheme)
NSFileReadTooLargeError = 263, // Read error (file too large)
NSFileReadUnknownStringEncodingError = 264, // Read error (string encoding of file contents could not be determined)
NSFileWriteUnknownError = 512, // Write error (reason unknown)
NSFileWriteNoPermissionError = 513, // Write error (permission problem)
NSFileWriteInvalidFileNameError = 514, // Write error (invalid file name)
NSFileWriteFileExistsError = 516, // Write error (file exists)
NSFileWriteInapplicableStringEncodingError = 517, // Write error (string encoding not applicable) also NSStringEncodingErrorKey
NSFileWriteUnsupportedSchemeError = 518, // Write error (unsupported URL scheme)
NSFileWriteOutOfSpaceError = 640, // Write error (out of disk space)
NSFileWriteVolumeReadOnlyError = 642, // Write error (readonly volume)
// NSFileManager unmount errors
NSFileManagerUnmountUnknownError = 768, // The volume could not be unmounted (reason unknown)
NSFileManagerUnmountBusyError = 769, // The volume could not be unmounted because it is in use
// Other errors
NSKeyValueValidationError = 1024, // KVC validation error
NSFormattingError = 2048, // Formatting error
NSUserCancelledError = 3072, // User cancelled operation (this one often doesn't deserve a panel and might be a good one to special case)
NSFeatureUnsupportedError = 3328, // Feature unsupported error
// Executable loading errors
NSExecutableNotLoadableError = 3584, // Executable is of a type that is not loadable in the current process
NSExecutableArchitectureMismatchError = 3585, // Executable does not provide an architecture compatible with the current process
NSExecutableRuntimeMismatchError = 3586, // Executable has Objective C runtime information incompatible with the current process
NSExecutableLoadError = 3587, // Executable cannot be loaded for some other reason, such as a problem with a library it depends on
NSExecutableLinkError = 3588, // Executable fails due to linking issues
// Inclusive error range definitions, for checking future error codes
NSFileErrorMinimum = 0,
NSFileErrorMaximum = 1023,
NSValidationErrorMinimum = 1024,
NSValidationErrorMaximum = 2047,
NSExecutableErrorMinimum = 3584,
NSExecutableErrorMaximum = 3839,
NSFormattingErrorMinimum = 2048,
NSFormattingErrorMaximum = 2559,
NSPropertyListReadCorruptError = 3840, // Error parsing a property list
NSPropertyListReadUnknownVersionError = 3841, // The version number in the property list is unknown
NSPropertyListReadStreamError = 3842, // Stream error reading a property list
NSPropertyListWriteStreamError = 3851, // Stream error writing a property list
NSPropertyListWriteInvalidError = 3852, // Invalid property list object or invalid property list type specified when writing
NSPropertyListErrorMinimum = 3840,
NSPropertyListErrorMaximum = 4095,
NSXPCConnectionInterrupted = 4097,
NSXPCConnectionInvalid = 4099,
NSXPCConnectionReplyInvalid = 4101,
NSXPCConnectionCodeSigningRequirementFailure = 4102,
NSXPCConnectionErrorMinimum = 4096,
NSXPCConnectionErrorMaximum = 4224,
NSUbiquitousFileUnavailableError = 4353, // NSURLUbiquitousItemDownloadingErrorKey contains an error with this code when the item has not been uploaded to iCloud by the other devices yet
NSUbiquitousFileNotUploadedDueToQuotaError = 4354, // NSURLUbiquitousItemUploadingErrorKey contains an error with this code when the item has not been uploaded to iCloud because it would make the account go over-quota
NSUbiquitousFileUbiquityServerNotAvailable = 4355, // NSURLUbiquitousItemDownloadingErrorKey and NSURLUbiquitousItemUploadingErrorKey contain an error with this code when connecting to the iCloud servers failed
NSUbiquitousFileErrorMinimum = 4352,
NSUbiquitousFileErrorMaximum = 4607,
NSUserActivityHandoffFailedError = 4608, // The data for the user activity was not available (e.g. if the remote device became unavailable.)
NSUserActivityConnectionUnavailableError = 4609, // The user activity could not be continued because a required connection was not available
NSUserActivityRemoteApplicationTimedOutError = 4610, // The remote application failed to send data in time
NSUserActivityHandoffUserInfoTooLargeError = 4611, // The NSUserActivity userInfo dictionary was too large to receive
NSUserActivityErrorMinimum = 4608,
NSUserActivityErrorMaximum = 4863,
NSCoderReadCorruptError = 4864, // Error parsing data during decode
NSCoderValueNotFoundError = 4865, // Data requested was not found
NSCoderInvalidValueError = 4866, // Data was not valid to encode
NSCoderErrorMinimum = 4864,
NSCoderErrorMaximum = 4991,
NSBundleErrorMinimum = 4992,
NSBundleErrorMaximum = 5119,
NSBundleOnDemandResourceOutOfSpaceError = 4992, // There was not enough space available to download the requested On Demand Resources.
NSBundleOnDemandResourceExceededMaximumSizeError = 4993, // The application exceeded the amount of On Demand Resources content in use at one time
NSBundleOnDemandResourceInvalidTagError = 4994, // The application specified a tag which the system could not find in the application tag manifest
NSCloudSharingNetworkFailureError = 5120, // Sharing failed due to a network failure.
NSCloudSharingQuotaExceededError = 5121, // The user doesn't have enough storage space available to share the requested items.
NSCloudSharingTooManyParticipantsError = 5122, // Additional participants could not be added to the share, because the limit was reached.
NSCloudSharingConflictError = 5123, // A conflict occurred while trying to save changes to the CKShare and/or root CKRecord. Respond to this error by first fetching the server's changes to the records, then either handle the conflict manually or present it, which will instruct the user to try the operation again.
NSCloudSharingNoPermissionError = 5124, // The current user doesn't have permission to perform the requested actions.
NSCloudSharingOtherError = 5375, // These errors may require application-specific responses. For CloudKit sharing, use the NSUnderlyingErrorKey, which is a CKErrorDomain error, to discover the specific error and refer to the CloudKit documentation for the proper response to these errors.
NSCloudSharingErrorMinimum = 5120,
NSCloudSharingErrorMaximum = 5375,
NSCompressionFailedError = 5376,
NSDecompressionFailedError = 5377,
NSCompressionErrorMinimum = 5376,
NSCompressionErrorMaximum = 5503,
};
所属库文件:Foundation/NSURLError.h
NS_ERROR_ENUM(NSURLErrorDomain)
{
NSURLErrorUnknown = -1,
NSURLErrorCancelled = -999,
NSURLErrorBadURL = -1000,
NSURLErrorTimedOut = -1001,
NSURLErrorUnsupportedURL = -1002,
NSURLErrorCannotFindHost = -1003,
NSURLErrorCannotConnectToHost = -1004,
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,
NSURLErrorAppTransportSecurityRequiresSecureConnection = -1022,
NSURLErrorFileDoesNotExist = -1100,
NSURLErrorFileIsDirectory = -1101,
NSURLErrorNoPermissionsToReadFile = -1102,
NSURLErrorDataLengthExceedsMaximum = -1103,
NSURLErrorFileOutsideSafeArea = -1104,
// SSL errors
NSURLErrorSecureConnectionFailed = -1200,
NSURLErrorServerCertificateHasBadDate = -1201,
NSURLErrorServerCertificateUntrusted = -1202,
NSURLErrorServerCertificateHasUnknownRoot = -1203,
NSURLErrorServerCertificateNotYetValid = -1204,
NSURLErrorClientCertificateRejected = -1205,
NSURLErrorClientCertificateRequired = -1206,
NSURLErrorCannotLoadFromNetwork = -2000,
// Download and file I/O errors
NSURLErrorCannotCreateFile = -3000,
NSURLErrorCannotOpenFile = -3001,
NSURLErrorCannotCloseFile = -3002,
NSURLErrorCannotWriteToFile = -3003,
NSURLErrorCannotRemoveFile = -3004,
NSURLErrorCannotMoveFile = -3005,
NSURLErrorDownloadDecodingFailedMidStream = -3006,
NSURLErrorDownloadDecodingFailedToComplete =-3007,
NSURLErrorInternationalRoamingOff = -1018,
NSURLErrorCallIsActive = -1019,
NSURLErrorDataNotAllowed = -1020,
NSURLErrorRequestBodyStreamExhausted = -1021,
NSURLErrorBackgroundSessionRequiresSharedContainer = -995,
NSURLErrorBackgroundSessionInUseByAnotherProcess = -996,
NSURLErrorBackgroundSessionWasDisconnected = -997,
};
所属库文件:StoreKit/SKError.h
typedef NS_ENUM(NSInteger,SKErrorCode) {
SKErrorUnknown,
SKErrorClientInvalid, // client is not allowed to issue the request, etc.
SKErrorPaymentCancelled, // user cancelled the request, etc.
SKErrorPaymentInvalid, // purchase identifier was invalid, etc.
SKErrorPaymentNotAllowed, // this device is not allowed to make the payment
SKErrorStoreProductNotAvailable API_AVAILABLE(ios(3.0), macos(10.15), watchos(6.2), visionos(1.0)), // Product is not available in the current storefront
SKErrorCloudServicePermissionDenied API_AVAILABLE(ios(9.3), tvos(9.3), watchos(6.2), macos(11.0), visionos(1.0)), // user has not allowed access to cloud service information
SKErrorCloudServiceNetworkConnectionFailed API_AVAILABLE(ios(9.3), tvos(9.3), watchos(6.2), macos(11.0), visionos(1.0)), // the device could not connect to the nework
SKErrorCloudServiceRevoked API_AVAILABLE(ios(10.3), tvos(10.3), watchos(6.2), macos(11.0), visionos(1.0)), // user has revoked permission to use this cloud service
SKErrorPrivacyAcknowledgementRequired API_AVAILABLE(ios(12.2), tvos(12.2), macos(10.14.4), watchos(6.2), visionos(1.0)), // The user needs to acknowledge Apple's privacy policy
SKErrorUnauthorizedRequestData API_AVAILABLE(ios(12.2), macos(10.14.4), watchos(6.2), visionos(1.0)), // The app is attempting to use SKPayment's requestData property, but does not have the appropriate entitlement
SKErrorInvalidOfferIdentifier API_AVAILABLE(ios(12.2), macos(10.14.4), watchos(6.2), visionos(1.0)), // The specified subscription offer identifier is not valid
SKErrorInvalidSignature API_AVAILABLE(ios(12.2), macos(10.14.4), watchos(6.2), visionos(1.0)), // The cryptographic signature provided is not valid
SKErrorMissingOfferParams API_AVAILABLE(ios(12.2), macos(10.14.4), watchos(6.2), visionos(1.0)), // One or more parameters from SKPaymentDiscount is missing
SKErrorInvalidOfferPrice API_AVAILABLE(ios(12.2), macos(10.14.4), watchos(6.2), visionos(1.0)), // The price of the selected offer is not valid (e.g. lower than the current base subscription price)
SKErrorOverlayCancelled API_AVAILABLE(ios(12.2), macos(10.14.4), watchos(6.2), visionos(1.0)),
SKErrorOverlayInvalidConfiguration API_AVAILABLE(ios(14.0), visionos(1.0)) API_UNAVAILABLE(macos, watchos) __TVOS_PROHIBITED,
SKErrorOverlayTimeout API_AVAILABLE(ios(14.0), visionos(1.0)) API_UNAVAILABLE(macos, watchos) __TVOS_PROHIBITED,
SKErrorIneligibleForOffer API_AVAILABLE(ios(14.0), macos(11.0), watchos(7.0), visionos(1.0)), // User is not eligible for the subscription offer
SKErrorUnsupportedPlatform API_AVAILABLE(ios(14.0), macos(11.0), watchos(7.0), visionos(1.0)) __TVOS_PROHIBITED,
SKErrorOverlayPresentedInBackgroundScene API_AVAILABLE(ios(14.5), visionos(1.0)) API_UNAVAILABLE(macos, watchos) __TVOS_PROHIBITED // Client tried to present an SKOverlay in UIWindowScene not in the foreground
} API_AVAILABLE(ios(3.0), macos(10.7), watchos(6.2), visionos(1.0));
所属库文件:StoreKit/SKANError.h
typedef NS_ERROR_ENUM(SKANErrorDomain, SKANError) {
SKANErrorImpressionMissingRequiredValue = 0,
SKANErrorUnsupported = 1,
SKANErrorAdNetworkIdMissing = 2,
SKANErrorMismatchedSourceAppId = 3,
SKANErrorImpressionNotFound = 4,
SKANErrorInvalidCampaignId = 5,
SKANErrorInvalidConversionValue = 6,
SKANErrorInvalidSourceAppId = 7,
SKANErrorInvalidAdvertisedAppId = 8,
SKANErrorInvalidVersion = 9,
SKANErrorUnknown = 10,
SKANErrorImpressionTooShort = 11,
} API_AVAILABLE(ios(15.4), visionos(1.0)) API_UNAVAILABLE(macos,watchos) __TVOS_PROHIBITED;