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

  • SEARCH
  • Home
  • 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 670125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:13:42+00:00 2026-05-14T00:13:42+00:00

Multiple NSURLConnections being started (in a single UIViewController) to gather different kinds of data.

  • 0

Multiple NSURLConnections being started (in a single UIViewController) to gather different kinds of data. When they return (-connectionDidFinishLoading) I wanna do stuff with the data, depending on the type of data that has arrived. But one prob, HOW DO I KNOW WHICH NSURLConnection returned? I need to know so I can take action specific to the type of data that came. (Eg. display a twitter update if it was the twitter xml data)(Eg. display an image if it was a photo)

How do people usually solve this?

  • 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-14T00:13:42+00:00Added an answer on May 14, 2026 at 12:13 am

    You keep pointers to both connections in the delegate, and compare these to the connection parameter in connection:didReceiveData: and connectiondidFinishLoading:

    For example:

    @interface Foo : NSObject {
        NSURLConnection *connection1;
        NSURLConnection *connection2;
    }
    

    and

    connection1 = [NSURLConnection connectionWithRequest:request1 delegate:self];
    connection2 = [NSURLConnection connectionWithRequest:request2 delegate:self];
    

    and

    - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
        if(connection == connection1) {
            // Connection 1
        } else if(connection == connection2) {
            // Connection 2
        }
    }
    
    - (void)connectionDidFinishLoading:(NSURLConnection *)connection {
        if(connection == connection1) {
            // Connection 1
        } else if(connection == connection2) {
            // Connection 2
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have multiple NSURLConnections running providing data back to the delegate objects. Is it
Can multiple HTML elements have the same ID if they're of different element types?
I frequently work with multiple instances of Visual Studio, often working on different branches
I have multiple projects in a couple of different workspaces. However, it seems like
Situation: multiple front-ends (e.g. Silverlight, ASP) sharing a single back-end server (WCF RIA or
Several multiple-monitor API functions (eg, MonitorFromRect ) return a HMONITOR handle to the monitor
Multiple forms are placed on a single page and are submitted via jquery. The
multiple plugins with same name? I started my search for a jquery validation with
I am am trying to get multiple NSURLConnections to run in parallel (synchronously), however
how can i render multiple different actions in one call to a speccific controller?

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.