cocoa
Cocoa & Foundation Error Codes
Error codes from Apple's Foundation framework, surfaced to iOS, iPadOS and macOS developers as NSError codes in the NSURLErrorDomain and NSCocoaErrorDomain domains.
27 codes
references developer.apple.com/documentation/foundation/nsurlerrordeveloper.apple.com/documentation/foundation/nscocoaerrordomain
· All codes 27 codes
- NSFileNoSuchFileError No Such File A file system operation, such as a move or copy, referenced a file or directory that does not exist.
- NSFileReadNoPermissionError File Read No Permission A read operation failed because the process lacks permission to read the file, often due to macOS sandboxing or App Sandbox entitlements.
- NSFileReadNoSuchFileError File Read No Such File A read operation failed because the specified file does not exist at the given path.
- NSFileWriteFileExistsError File Write File Exists A write or move operation failed because a file already exists at the destination path and the operation did not request overwriting it.
- NSFileWriteNoPermissionError File Write No Permission A write operation failed because the process lacks permission to write to the destination, a very common cause being a path outside the app's sandbox container.
- NSFileWriteOutOfSpaceError File Write Out of Space A write operation failed because the volume ran out of free space.
- NSKeyValueValidationError Key-Value Validation A value failed the validation performed by a Key-Value Coding validateValue:forKey:error: method, for example when Core Data enforces a model's attribute constraints.
- NSPropertyListReadCorruptError Property List Read Corrupt A property list or JSON document could not be parsed because its data is malformed; JSONSerialization reuses this NSCocoaErrorDomain code for malformed JSON.
- NSURLErrorAppTransportSecurityRequiresSecureConnection App Transport Security Requires Secure Connection The app attempted an insecure HTTP connection that App Transport Security blocks by default; the app's Info.plist must declare an ATS exception or the endpoint must be moved to HTTPS.
- NSURLErrorBadServerResponse Bad Server Response The server's response could not be parsed as valid HTTP, for example because it was truncated or malformed.
- NSURLErrorBadURL Bad URL A malformed URL prevented a URL request from being initiated.
- NSURLErrorCancelled Cancelled An asynchronous load was cancelled, typically because the URLSessionTask was explicitly cancelled or its containing view was deallocated.
- NSURLErrorCannotConnectToHost Cannot Connect to Host A TCP connection to the host could not be established, typically because the server is down, the port is closed, or a firewall is blocking the connection.
- NSURLErrorCannotFindHost Cannot Find Host DNS resolution failed to find an IP address for the given host name, usually because the host name is misspelled, unregistered, or the device has no working DNS server.
- NSURLErrorDNSLookupFailed DNS Lookup Failed Host name resolution failed at the DNS server level, distinct from cannotFindHost, which is raised when no address record exists at all.
- NSURLErrorHTTPTooManyRedirects HTTP Too Many Redirects A request was redirected too many times, usually indicating a redirect loop between two or more URLs.
- NSURLErrorNetworkConnectionLost Network Connection Lost The connection to the server was dropped mid-request, for example by a network interface change such as switching from Wi-Fi to cellular.
- NSURLErrorNotConnectedToInternet Not Connected to Internet The device has no active network connection at all. One of the most frequently encountered NSURLErrorDomain codes, since it fires immediately for offline devices instead of waiting for a timeout.
- NSURLErrorResourceUnavailable Resource Unavailable The requested resource could not be retrieved, for a reason not covered by the other, more specific NSURLErrorDomain codes.
- NSURLErrorSecureConnectionFailed Secure Connection Failed An attempt to establish a TLS/SSL connection failed for a reason not covered by the more specific certificate error codes.
- NSURLErrorServerCertificateHasBadDate Server Certificate Has Bad Date The server's TLS certificate has expired or is not yet valid according to its notBefore/notAfter dates.
- NSURLErrorServerCertificateUntrusted Server Certificate Untrusted The server's TLS certificate chain does not chain up to a trusted root, commonly seen with self-signed certificates in development.
- NSURLErrorTimedOut Timed Out An asynchronous operation timed out before it could complete, often because the server was slow or unreachable and no response arrived within the request's timeout interval.
- NSURLErrorUnknown Unknown The URL Loading System encountered an error that does not correspond to any of the more specific NSURLErrorDomain codes.
- NSURLErrorUnsupportedURL Unsupported URL The URL scheme is not one that the URL Loading System, or an installed URLProtocol, knows how to handle.
- NSURLErrorUserAuthenticationRequired User Authentication Required Authentication is required to access the resource but no valid credentials were supplied, typically surfaced from an HTTP 401 response.
- NSUserCancelledError User Cancelled An operation was cancelled by explicit user action, such as clicking Cancel in a save or open panel.