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 8602199
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T02:01:22+00:00 2026-06-12T02:01:22+00:00

I have an issue with the connection:didWriteData:totalBytesWritten:expectedTotalBytes: method of the NSURLConnectionDownloadDelegate under iOS 6.

  • 0

I have an issue with the

connection:didWriteData:totalBytesWritten:expectedTotalBytes:

method of the NSURLConnectionDownloadDelegate
under iOS 6.

Under iOS 5 Simulator it works just fine, giving me the right expectedTotalBytes value.

On iOS 6 Simulator, the expectedTotalBytes always returns 0. The totalBytesWritten value is still right.

It’s the same request, the same URL, just the OS Version is different.

Has anyone encountered a similar issue or has any idea what could cause this?

Cheers
Kim

  • 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-12T02:01:24+00:00Added an answer on June 12, 2026 at 2:01 am

    Just spent a good amount of time investigating the same issue. It turned out to be that in iOS6 the request is first made with HEAD to investigate the headers, which is not that abnormal.

    However it seems headers from the response to the actual GET request are ignored. As a result if your server did not support HEAD or returned 0 content length for HEAD request against a given URL, iOS NSURLConnection will use wrong information.

    My problem was that my custom server did not support HEAD requests for files I was downloading, and instead returned a 405 (HTTP Error 405 Method not allowed) which in its own response contained a content length that then iOS6 used when returning expectedTotalBytes, not the correct one from the GET response.

    To fix my problem, I first enabled HEAD for my file download requests and then made sure the correct content length was returned. Verified with:

    curl -v -I http://url
    ...
    < Content-Length: 23493947
    Content-Length: 23493947
    

    Not sure if that is bug in iOS6 or just better compliance with the HTTP standards. Hope that helps others.

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

Sidebar

Related Questions

I have a batch script that invokes PLSQL with connection details, which works fine
I have a quick issue with my connection not being intialized. When I call
Just started mongo and started having issue with querying already. i have a collection
I have little issue with detecting internet connection while using static IP on device.
I have an issue retrieving ajax data using jquery 1.3.2 / 1.4.2: It works
I have an issue similar to this one: SQL Server 2008: ODBC connection problems
I have tried some labs in Windows Azure and it works fine. So, I
I have an issue setting a JLabel 's text using a method in the
I have an issue with json parsing -I established a connection to a remote
I have an issue with the sqlite3_mutex_enter(v->db->mutex) error message on an iOS application. The

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.