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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T16:04:05+00:00 2026-06-01T16:04:05+00:00

In the Xcode project, I have 2 classes say ParentViewController and another class ChildViewController

  • 0

In the Xcode project, I have 2 classes say ParentViewController and another class ChildViewController which is the sub class of ParentViewController. In ParentViewController class we use NSURLConnection, didReceiveData and connectionDidFinishLoading to fetch some data from back end server. It works perfectly fine. Now in my ChildViewController I need to make connection and fetch data from backend as well. But if I add didReceiveData and connectionDidFinishLoading in ChildViewController, then the didReceiveData in ParentViewController seems doesn’t work anymore. I am wondering why?

Also seems I have a lot of different requests send to backend, so my didReceiveData and connectionDidFinishLoading are overwhelminged with (connect == someConnection) statements. I am wondering any neat way to handle this situation? Thanks.

  • 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-01T16:04:05+00:00Added an answer on June 1, 2026 at 4:04 pm

    The subclass will inherit the ParentViewController’s connection delegate methods. If you want the same behavior in the subclass, just don’t implement the delegate methods there.

    Another idea is to avoid the delegate methods altogether. In iOS5, the NSURLConnection provides a better way to start a connection using a block for completion, so your code for each connection can be located in context, as follows:

    NSURLRequest *requestA = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http..."]];
    [NSURLConnection sendAsynchronousRequest:requestA queue:[NSOperationQueue currentQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
        // do what you need to do when requestA completes
    }];
    
    NSURLRequest *requestB = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http..."]];
    [NSURLConnection sendAsynchronousRequest:requestA queue:[NSOperationQueue currentQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *error) {
        // do what you need to do when requestB completes
    }];
    

    I agree with the other answers that you might want to rethink the design if the app is doing a lot of remote requests.

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

Sidebar

Related Questions

I have an xcode project which has 2 classes - Stem & Player, I'm
Now I have a Xcode project which is built for iOS 5, but now
I have an old Xcode project which contains a CoreData model (containing a version
I have an xcode project which crashes xcode every time it's opened. Xcode says
I have a xcode/phonegap project where I want to use the sharekit - not
I have a project MY_PROJECT. In xcode, I see all the classes under Classes
I have an Xcode project with the following group structure: ProjectName/ Classes/ class1.h class1.m
I have two frameworks in my Xcode project that both define a class with
I am using Xcode 4.2 in which I have created various classes which shows
I have created a project in xcode which creates a .a file. fine, this

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.