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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T01:07:23+00:00 2026-06-10T01:07:23+00:00

I am facing weired issue. I am sending Asynchronus NSUrlrequest call but in return

  • 0

I am facing weired issue. I am sending Asynchronus NSUrlrequest call but in return i am getting multiple time responde with some part of json

can someone please help me with what I did wrong.

code

NSString *_query = @"http://abc.com/index.php";

    NSData *myRequestData = [NSData dataWithBytes:[_requestString UTF8String] 
                                       length:[_requestString length]];


    __block NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:_query]]; 

    [request setHTTPMethod: @"POST" ];
    [request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"content-type"];
    [request setHTTPBody: myRequestData ];

    [[NSURLConnection alloc] initWithRequest:request delegate:self];

    NSRunLoop *runLoop = [NSRunLoop currentRunLoop];

    [runLoop addTimer:timeOutTimer forMode:NSDefaultRunLoopMode];

Response

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data 
{
    // check is response is a valid JSON?
    NSError *error;

    id jsonObj = [NSJSONSerialization JSONObjectWithData: data options:kNilOptions error:&error];
    BOOL isValid = [NSJSONSerialization isValidJSONObject:jsonObj];


    NSString *content = [[NSString alloc] initWithData:data 
                                              encoding:NSUTF8StringEncoding];

    NSLog(@"Content: %@",content);

    if (isValid)
    {
        NSDictionary *data = [content JSONValue];
    }


    [content release];
}
  • 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-10T01:07:25+00:00Added an answer on June 10, 2026 at 1:07 am

    As data is received by the client, this callback gets called:

    - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
    

    didReceiveData is giving you data as it’s receiving it and can be called multiple times with chunks of the data.

    From the NSURLConnection docs:

    The delegate is periodically sent connection:didReceiveData: messages
    as the data is received. The delegate implementation is responsible
    for storing the newly received data.

    From those docs:

    - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
    {
        // Append the new data to receivedData.
        // receivedData is an instance variable declared elsewhere.
        [receivedData appendData:data];
    }
    

    When its all done, connectionDidFinishLoading will get called and your appended data is ready for you to use.

    Finally, if the connection succeeds in downloading the request, the
    delegate receives the connectionDidFinishLoading: message. The
    delegate will receive no further messages for the connection and the
    NSURLConnection object can be released.

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

Sidebar

Related Questions

My development team of four people has been facing this issue for some time
I'm facing some weird css issue with django . My css works fine but
I am facing some weird issue . Executing one rule ( last rule )
I am facing some issue in printing a form created using absolute positioning in
This has been asked a lot, but I'm still facing some issues with it.
We are facing a weird issue and need some brain storming here. I will
We are facing a weird issue. We have NFS set up with 2 machines
I am facing a weird issue. I am changing the text color of my
I have been facing a weird issue in a piece of code. void app_ErrDesc(char
I'm facing a weird issue. I wrote a small server in C++ that stores

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.