SSErrorDomain error code 109. Downloading news from Amazon S3

When uploading a file from Amazon S3 to iOS. With a break NSURLConnectionDownloadDelegate method didFailWithError: gets called and this is what I got when I logged the resulting NSError object

Error code: 109 Domain error: SSErrorDomain Error Description: "Unable to connect to"

Searched all the Apple documentation, StackOverflow and other sites but couldn't find anything on that. I also raised a tech request for Apple today using my developer account.

Any idea?


So by looking at the HTTP response error code (403 Forbidden) I got this idea. This is due to the "RequestTimeTooSkewed" error from S3 (the difference between the request time and the current time is too great). I crossed myself checking this by changing the iPad / Mac system time to 1 hour and this error will come right away, even for a small file (200KB).

Now, as suggested in many blogs, I first make a HEAD AWS request like below to get the Date string and not pass the Date system

NSString *awsURL = @"";
    NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:awsURL]];  
    [request setHTTPMethod:@"HEAD"];  

    NSHTTPURLResponse *response;  
    [NSURLConnection sendSynchronousRequest:request returningResponse:&response error: NULL];  

    NSString *dateString = nil;  

    if ([response respondsToSelector:@selector(allHeaderFields)]) {  
        dateString = [[response allHeaderFields] objectForKey:@"Date"];  
    return dateString;


and set this as date header in NSMutableURLRequest

[urlRequest setValue:awsDateString forHTTPHeaderField:@"Date"];


This request I am adding to my download issue

 NKAssetDownload *nkAssetDownload = [nkIssue addAssetWithRequest:urlRequest];


Still the same error !!!! Now this is crazier than my last situation.


Update 2

I managed to make the request successfully (even my iPad's system clock is incorrect) by replacing "GMT" with "+0000" in the date string.

Update 3 However, some queries fail with the same error, which is weird, but I'm guessing it's something like NewsStand Framework.


source to share

1 answer

So this is RequestTimeTooSkewed error and the above code for getting date from server response to S3 server to add request does the trick.



All Articles