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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:14:46+00:00 2026-05-22T15:14:46+00:00

I have a NSURLConnection that gets data from a JSON web service, and everything

  • 0

I have a NSURLConnection that gets data from a JSON web service, and everything works fine. I’m using it to post something to the server and get a success response.

After that call I want to initiate another NSURLConnection to refresh the data, so I’m doing so inside the connectionDidFinishLoading method, however this second connection isn’t calling connectionDidFinishLoading when it is done loading.

Can I not initiate a NSURLConnection from inside the connectionDidFinishLoading method?

EDIT: Below is the code. I subclassed NSURLConnection to include a Tag NSString, calling the new class NSURLConnectionHelper. I’m using this to differentiate which connection has called the connectionDidFinishLoading.

- (void)connectionDidFinishLoading:(NSURLConnectionHelper *)connection
{ 

        if([connection.Tag isEqual:@"NewMessage"]){

            NSString *jsonString = [[NSString alloc] initWithData:receivedNewMessageData encoding:NSASCIIStringEncoding];

            NSDictionary *results = [jsonString JSONValue];

            [jsonString release];

            [connection release];

            if ([[results objectForKey:@"MessageAdded"] isEqual:@"True"]) {

                User *newUser = [[User alloc] init];
                [newUser retrieveFromUserDefaults];

                if([newUser IsLoggedIn]){
                Message *message = (Message *)[messages objectAtIndex: 0];

                        NSString *urlAsString = // url for webservice goes here

                        NSURL *url = [NSURL URLWithString:urlAsString];
                        NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url];
                        NSURLConnectionHelper *connection1 = [[NSURLConnectionHelper alloc] initWithRequest:request delegate:self];
                        connection1.Tag = @"GetLatestMessages";

                        [request release];

                        if (connection1) {
                                receivedLatestMessagesData = [[NSMutableData data] retain];
                        } else {
                                // Inform the user that the connection failed.
                        }
                }            
            }
      }else if([connection.Tag isEqual:@"GetLatestMessages"]){
    //do some other stuff but this code is never reached
  }
}
  • 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-05-22T15:14:46+00:00Added an answer on May 22, 2026 at 3:14 pm

    I ended up having a space in my web service url, once I corrected that it worked.

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

Sidebar

Related Questions

First, I'm using an NSURLConnection to download JSON data from twitter. Then, I'm using
I have a NSURLConnection that receives data output from a url pointing to a
I am using NSURLConnection to download a zipped file from a web service. In
I have a NSURLConnection that is working fine when I allow the load to
An iPhone question for you guys! I have an NSURLConnection that downloads XML from
I have setup an NSURLConnection using the guidelines in Using NSURLConnection from the Mac
I'm using NSURLConnection as listed below. I have three questions about this class. When
Morning Everyone, I've been attempting to write an application that does some GETs from
I have a controller that makes HTTP GET requests using a custom class, which
I am writing a code that reads data from a http connection and 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.