Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7923841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T17:26:57+00:00 2026-06-03T17:26:57+00:00

I’ve encountered a problem using AFNetworking to download files from a Rackspace repository. Basically

  • 0

I’ve encountered a problem using AFNetworking to download files from a Rackspace repository.

Basically sometimes the file is not completelly transfered but AFNetworking fires the success block. Also the http response code received is set to 200 OK.

This situation only happens on a 3G connection. On WiFi we correctly receive all the files.

Can anyone give us any hints on what can be causing this behaviour?

Edit, 2012-05-10
I’ve detected that the problem may be elsewhere, what I am doing is checking the CRC of the file and compare it to the expected CRC. However (and it only happens when the connection is over 3G) the CRC check fails. Below are some snippets of the code I’m using to download the file and then check it’s CRC:

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:urlNS];

AFImageRequestOperation * imageRequestOperation = [AFImageRequestOperation imageRequestOperationWithRequest:request
                                                   imageProcessingBlock:nil
                                                   cacheName: nil
                                                   success: ^(NSURLRequest * request, NSHTTPURLResponse * response, UIImage * image)
                                                   {
                                                       [self.class postProcessDownloadAfNetworking: request andResponse: response resultImage: image error: nil];
                                                   }
                                                   failure: ^(NSURLRequest * request, NSHTTPURLResponse * response, NSError * error)
                                                   {
                                                       [self.class postProcessDownloadAfNetworking: request andResponse: response resultImage: nil error: error];                                                        
                                                   }];

imageRequestOperation.outputStream = [NSOutputStream outputStreamToFileAtPath:obj.destinationFilename append:NO];


[imageRequestOperation start]; 

And then in the callback method:

if(error == nil)
{
    NSData * data = [NSData dataWithContentsOfFile:imgData.destinationFilename];
    uint32_t fileCrcInt = [data crc32];
    NSString * fileCrcHex  = [NSString stringWithFormat:@"%2X", (int) fileCrcInt] ;
    NSString * fileCrcHex2 = [NSString stringWithFormat:@"000000%@", fileCrcHex] ;
    fileCrcHex2 = [fileCrcHex2 substringFromIndex:[fileCrcHex2 length]-8];

    // Compare CRC
    if( [expectedCRC isEqualToString:fileCrcHex2] )
    {
       (...)

Is it possible that the instruction [NSData dataWithContentsOfFile:] is reading the file before the Output Stream from AFNetworking writes it completely? Maybe I’m encountering some kind of iOS disk cache or something like that.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T17:26:58+00:00Added an answer on June 3, 2026 at 5:26 pm

    In the absence of other data, I’ll take a wild guess:

    Certain file types may be subject to a transparent proxy over 3G, which may alter those files. This is with widely-recognized file types with lossy compression. Basically, if you’re trying to download a JPEG the proxy might deliver a smaller JPEG than you expect. The cell provider considers it “close enough”, and the doubly-compressed JPEG is smaller (and far uglier). Naturally, the re-compressed image will have a different CRC.

    This may be true of other file types as well.

    I have read reports of T-Mobile doing this. I think it’s been noted with other cell providers, too.

    There’s two possible fixes:

    As noted by Tony Million in a comment below, switching to HTTPS will fix this problem as the proxy will no longer be in the middle of the communication.

    If your resource is available via HTTPS, this is a fantastic and simple fix.

    If not, you can try adding a HTTP header intended to defeat this. I can’t verify it will work for you, as my cell provider doesn’t play this particular game:

    http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.5

    The idea is to add a no-transform cache-control HTTP header to your request. This should disallow the server from making this kind of change.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I am currently running into a problem where an element is coming back from
I have thousands of HTML files to process using Groovy/Java and I need to
I have a bunch of posts stored in text files formatted in yaml/textile (from
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
Basically, what I'm trying to create is a page of div tags, each has

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.