Undocumented NSURLErrorDomain error codes (-1001, -1003 and -1004) using StoreKit
All error codes are on "CFNetwork Errors Codes References" on the documentation (link)
A small extraction for CFURL and CFURLConnection Errors:
kCFURLErrorUnknown = -998, kCFURLErrorCancelled = -999, kCFURLErrorBadURL = -1000, kCFURLErrorTimedOut = -1001, kCFURLErrorUnsupportedURL = -1002, kCFURLErrorCannotFindHost = -1003, kCFURLErrorCannotConnectToHost = -1004, kCFURLErrorNetworkConnectionLost = -1005, kCFURLErrorDNSLookupFailed = -1006, kCFURLErrorHTTPTooManyRedirects = -1007, kCFURLErrorResourceUnavailable = -1008, kCFURLErrorNotConnectedToInternet = -1009, kCFURLErrorRedirectToNonExistentLocation = -1010, kCFURLErrorBadServerResponse = -1011, kCFURLErrorUserCancelledAuthentication = -1012, kCFURLErrorUserAuthenticationRequired = -1013, kCFURLErrorZeroByteResource = -1014, kCFURLErrorCannotDecodeRawData = -1015, kCFURLErrorCannotDecodeContentData = -1016, kCFURLErrorCannotParseResponse = -1017, kCFURLErrorInternationalRoamingOff = -1018, kCFURLErrorCallIsActive = -1019, kCFURLErrorDataNotAllowed = -1020, kCFURLErrorRequestBodyStreamExhausted = -1021, kCFURLErrorFileDoesNotExist = -1100, kCFURLErrorFileIsDirectory = -1101, kCFURLErrorNoPermissionsToReadFile = -1102, kCFURLErrorDataLengthExceedsMaximum = -1103,
I have similar problems, in my case seem to be related to network connectivity:
Error Domain=NSURLErrorDomain Code=-1001 "The request timed out."
Things to check:
- Is there any chance that your server is not able to respond within some time limit? Like 60 seconds or 4 minutes?
- Is there a possibility that your device is switching networks (WiFi, 3G, VPN)?
- Could someone (client vs. server) be waiting for authentication?
Sorry, no ideas how to fix. Just debugging this, trying to find out what the problem is (-1021, -1001, -1009)
Update: Google search was very kind to find this:
- -1001 TimedOut - it took longer than the timeout which was alotted.
- -1003 CannotFindHost - the host could not be found.
- -1004 CannotConnectToHost - the host would not let us establish a connection.
see NSURLError.h Define
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 NS_ENUM_AVAILABLE(10_11, 9_0) = -1022,NSURLErrorFileDoesNotExist = -1100,NSURLErrorFileIsDirectory = -1101,NSURLErrorNoPermissionsToReadFile = -1102,NSURLErrorDataLengthExceedsMaximum NS_ENUM_AVAILABLE(10_5, 2_0) = -1103,// SSL errorsNSURLErrorSecureConnectionFailed = -1200,NSURLErrorServerCertificateHasBadDate = -1201,NSURLErrorServerCertificateUntrusted = -1202,NSURLErrorServerCertificateHasUnknownRoot = -1203,NSURLErrorServerCertificateNotYetValid = -1204,NSURLErrorClientCertificateRejected = -1205,NSURLErrorClientCertificateRequired = -1206,NSURLErrorCannotLoadFromNetwork = -2000,// Download and file I/O errorsNSURLErrorCannotCreateFile = -3000,NSURLErrorCannotOpenFile = -3001,NSURLErrorCannotCloseFile = -3002,NSURLErrorCannotWriteToFile = -3003,NSURLErrorCannotRemoveFile = -3004,NSURLErrorCannotMoveFile = -3005,NSURLErrorDownloadDecodingFailedMidStream = -3006,NSURLErrorDownloadDecodingFailedToComplete =-3007,NSURLErrorInternationalRoamingOff NS_ENUM_AVAILABLE(10_7, 3_0) = -1018,NSURLErrorCallIsActive NS_ENUM_AVAILABLE(10_7, 3_0) = -1019,NSURLErrorDataNotAllowed NS_ENUM_AVAILABLE(10_7, 3_0) = -1020,NSURLErrorRequestBodyStreamExhausted NS_ENUM_AVAILABLE(10_7, 3_0) = -1021,NSURLErrorBackgroundSessionRequiresSharedContainer NS_ENUM_AVAILABLE(10_10, 8_0) = -995,NSURLErrorBackgroundSessionInUseByAnotherProcess NS_ENUM_AVAILABLE(10_10, 8_0) = -996,NSURLErrorBackgroundSessionWasDisconnected NS_ENUM_AVAILABLE(10_10, 8_0)= -997,