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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T23:53:13+00:00 2026-05-15T23:53:13+00:00

I have a function, in UpdateViewController, that is being called by a delegate, MyDownloadController,

  • 0

I have a function, in UpdateViewController, that is being called by a delegate, MyDownloadController, that will close a modal view (which is the UpdateViewController).

-(void)errorDownloading {
    self.downloadController.delegate = nil;
    [downloadController release];

    [self dismissModalViewControllerAnimated:YES];
} 

I’ve tried doing this with and without messing with the delegate pointer and it still doesn’t close the view.

The delegate calls the method like this within MyDownloadController:

-(void)connectionError {
    if([delegate respondsToSelector:@selector(errorDownloading)]){
        [delegate errorDownloading];
    }
}

And this function is called by a different delegate (MyConnectionController).

Is there anything wrong with having this many delegates? And would a pointer error or something with them effect the modalview being able to close? If so, how / why?

I have this structure for the delegations:

UpdateViewController (the actual modal view I am trying to close)
|- MyDownloadController (the controller that abstracts the process being done)
    |- MyConnectionController (a helper class I wrote to interact with NSURLConnection)
        |- NSURLConnection

What is the best way to diagnose this problem?

  • 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-15T23:53:14+00:00Added an answer on May 15, 2026 at 11:53 pm

    Apple documentation says:

    dismissModalViewControllerAnimated:

    Dismisses the modal view controller that was presented by the receiver.

    Mean’s you call the the dismissModalViewControllerAnimated: method on the viewController that presented the ModalViewController you want to dismiss. in your case, this is the correct code to use.

    -(void)errorDownloading {
        self.downloadController.delegate = nil;
        [downloadController release];
    
        [self.parentViewController dismissModalViewControllerAnimated:YES];
    }
    

    Also answer to your other questions on number of delegates and pointers. Better design usually means you don’t have huge strings of delegate objects but there’s little reason to say thats wrong, it just gets messy IMHO. Pointers and the such as you described would most likely cause leaks or crashes, the reason it won’t close is what I specified above, you weren’t calling the method to the proper receiver.

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

Sidebar

Related Questions

Assume that i have function called PlaceOrder , which when called inserts the order
I have function some_func_1 which will create an object of type some_type and will
Inside my Controller i have function that runs after user clicks on item, which
I have function which takes in an parameter of a class called Triple, and
I have function getMemory() which returns VARIANT (mfc). It is said that in ulVal
I have function along these lines: public void view(string msg) { messagebox.show(msg); } .
I have function which checks the score and will(I haven't finished) increases level if
I have function getCartItems in cart.js and I want to call that function in
I have function Start() that is fired on ready. When I click on .ExampleClick
i have function which return list as given below. List<User> lstUsers = SearchUsers(searchText); which

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.