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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:37:39+00:00 2026-05-27T06:37:39+00:00

This is a simplification, but I have an app that has the following methods:

  • 0

This is a simplification, but I have an app that has the following methods:

//This is a common function that is used by various functions in my app to send a HTTP Post via NSURLConnection
- (void)sendPostWithURL:(NSString*)url

//This is the NSURLConnection function that has the response data
- (void)connectionDidFinishLoading:(NSURLConnection *)connection

//myFunction1: send a HTTP Post and receive response1.json
-(void)myFunction1{
 [self sendPostWithURL:@"http://www.somesite.com/response1.json"];
 }

//myFunction2: send a HTTP Post and receive response2.json
-(void)myFunction2{
 [self sendPostWithURL:@"http://www.somesite.com/response2.json"];
}

So as you can see, I have two functions (myFunction1 and myFunction2) that share a common NSURLConnection for sending and receiving data.

In the connectionDidFinishLoading() function, how can I tell whether the response is for myFunction1 or myFunction2?

I have one possibility, such as requesting that within the json response data, there is one key/value pair that allows me to see which response it is. However, I have a feeling that there is a more elegant way for me to do this within the code itself.

Any advice would be great! Thank you!

  • 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-27T06:37:40+00:00Added an answer on May 27, 2026 at 6:37 am

    You are calling them “functions”. If you start thinking of them as “methods” in a class, a lot of this will make more sense.

    You need to encapsulate all of the NSURLConnection stuff in a class (called, say, Downloader.m).
    Downloader.m will have methods: sendPostWithUrl and connectionDidFinishLoading.

    Then, when you need to download something, instantiate a new instance of downloader, and call it’s sendPost method. You will have a specific class instance for each download operation and those should be easy enough to keep track of.

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

Sidebar

Related Questions

I have this (simplification): $(li).click(function{alert(test);}); <li> <input> </li> What's the best way to bind
I have a boolean simplification problem that's already been solved.. but I'm having a
I'm creating logic simplification program in sml. But I have a problem for this
So, I'm confused. I have a module containing some function that I use in
I have a simulation that has a huge aggregate and combine step right in
I have a view that has a list of jobs in it, with data
I have just used proguard, but classes I am trying to instantiate via reflection
It seems that this question gets asked frequently , but I am not coming
I have two dictionaries, but for simplification, I will take these two: >>> x
I have two dictionaries, but for simplification, I will take these two: >>> x

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.