Undocumented Nsurlerrordomain Error Codes (-1001, -1003 and -1004) Using Storekit

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,

NSURLErrorDomain Code=-1001 error when a http post request is sent

Apparently my post request was getting a timeout error since I was sending an image that the server would find too large. I scaled down the images in order to make my images acceptable by the server.

As this post suggests, NSURLErrorDomain Code=-1001 error might be caused by many things including;

  • Server response time limit
  • Server rules about the incoming data
  • Authentication problems

Hope that helps to other people

Swift iOS 9 NSURLErrorDomain Error -1004

After messing around with a ton of different keys and values to make it work, I finally have come up with this to make it function in iOS9.1:

NSAppTransportSecurity

NSAllowsArbitraryLoads

NSExceptionDomains

mydomain.com

NSIncludesSubdomains

NSTemporaryExceptionAllowsInsecureHTTPLoads

NSTemporaryExceptionMinimumTLSVersion
TLSv1.1
NSExceptionRequiresForwardSecrecy

NSRequiresCertificateTransparency




After I added the last one NSRequiresCertificateTransparency and set that to false it worked, so that's probably the most important one.

NSURLErrorDomain error codes description

The NSURLErrorDomain error codes are listed here https://developer.apple.com/documentation/foundation/1508628-url_loading_system_error_codes

However, 400 is just the http status code (http://www.w3.org/Protocols/HTTP/HTRESP.html) being returned which means you've got something wrong with your request.

Are NSURLErrorDomain error messages supposed to appear in the Xcode console?

Those are system logs printed by the OS. You can disable them from your active scheme.

Edit your scheme and add an environment variable as shown at the image below.

Sample Image

NSURLErrorDomain code=-1005 from GKLeaderboard loadScoresWithCompletionHandler:

For some reason this alternative call does not lead to errors:

GKLeaderboard *leaderboard = 
[[GKLeaderboard alloc] initWithPlayers:@[ GKLocalPlayer.localPlayer ]];

leaderboard.identifier = leaderboardIdentifier;
leaderboard.timeScope = GKLeaderboardTimeScopeAllTime;

[leaderboard loadScoresWithCompletionHandler:^(NSArray *scores, NSError *error) {
// ...
}];

Problem solved.



Related Topics



Leave a reply



Submit