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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:34:01+00:00 2026-06-10T15:34:01+00:00

I have the worst internet connection atm, so sorry if this has been asked

  • 0

I have the worst internet connection atm, so sorry if this has been asked before..

I have an NSURLConnection for getting some json data. Until now it worked perfectly fine to use the delegate method didReceiveData:(NSData*)data to save the received data. I am downloading data from at least seven different pages at the same time. Today, after updati g on of the json-pages to contain more data, the NSData object seemed corrupt. I have recently been told that this delegate does not return the whole data, and thus corrupting my information.

Is there another delegate like the didFinish only it also returns the full complete object? Or do I have to do this myself, like merging two NSData’s?

Sorry for stupidity, and grammatical errors are dedicated to iPhone auto-correct.

  • 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-10T15:34:03+00:00Added an answer on June 10, 2026 at 3:34 pm

    You must never, ever rely on didReceiveData: returning the full data, because it will break one day. You have to collect your chunks of data in an NSMutableData:

    NSMutableData *d = [[NSMutableData alloc] init];
    
    - (void)connection:(NSURLConnection *)c didReceiveData:(NSData *)data
    {
        [d appendData:data];
    }
    
    - (void)connectionDidFinishLoading:(NSURLConnection *)conn
    {
        // 'd' now contains the entire data
    }
    

    If it’s inconvenient for you, you can avoid using NSURLConnection and use a background thread to grab the data in one piece using:

    NSData *data = [NSData dataWithContentsOfURL:[NSURL URLWithString:@"http://web.service/response.json"]];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have implented some lovely forms authentication in ASP.NET MVC 3, this has been
I have 5 servers on a LAN without Internet connection. I need them to
I have been tasked with sifting through the worst classic asp spaghetti i've ever
This is probably the worst question I have ever posted on Stack Overflow but
Alright this probably is the worst error I have found ever. I have two
If I have some algorithm that runs at best n time and at worst
XML has its uses. What is the worst abuse of XML that you have
I'm on holidays at present and have been doing some work, committing and pushing
I have been using the MySql Query Browser and [opinion]it has to be the
1-)For sorted array I have used Binary Search. We know that the worst case

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.