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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T02:31:09+00:00 2026-06-08T02:31:09+00:00

I have ParentViewController that allocates ChildViewController , pushes it onto controller stack and releases

  • 0

I have ParentViewController that allocates ChildViewController, pushes it onto controller stack and releases it.

ChildViewController implements the protocol ProductDownloadDelegateProtocol required by the Product class.

At some point, ChildViewController creates a Product object and sets itself as its downloadDelegate.

While downloading, Product class updates ChildViewController via methods defined in ProductDownloadDelegateProtocol.

If the user presses the back button in the navBar of ChildViewController while downloading, the next update of download percentage from Product causes an EXC_BAD_ACCESS.

Although Product checks if downloadDelegate is nil, problem still occurs since ChildViewController/downloadDelegate is deallocated, but not set as nil. I don’t know which point is best to set ChildViewController to nil.

Is my design wrong?

  • 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-08T02:31:12+00:00Added an answer on June 8, 2026 at 2:31 am

    If your ChildViewController creates an instance of Product and sets itself as the delegate, it should be its responsibility to remove itself as the delegate when it’s about to be unloaded. Either in it’s viewDidUnload or dealloc method you should be setting the Product delegate to nil.

    If ChildViewController stays around (say you are reusing the view controller), maybe you can remove it as the delegate in the viewWillDissappear method.

    Another solution to fix this particular EXC_BAD_ACCESS issue is to move to ARC and use Zeroing Weak References (see a good writeup here, http://www.mikeash.com/pyblog/friday-qa-2010-07-16-zeroing-weak-references-in-objective-c.html).

    Still, I would recommend you move to ARC for the right reasons, and not to fix this particular issue you are facing.

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

Sidebar

Related Questions

I have a UINavigationController(a) that pushes a UIViewController(b) onto the stack. (b) contains a
I have a class ParentViewController that implements a UITapGestureRecognizer with the target method being
I have two NIB's ParentViewController.xib ChildViewController.xib ParentViewController.xib contains a UIView and a UIViewController. ChildViewController.xib
I have a view containing a segmented controller and a UIDatePicker that only shows
I have a view controller that is used to populate data from the core
I have a viewController that I am presenting as modalViewController in my ParentViewController. The
I have a SubSelectVC that handles sub-selection choice that is presented modally from a
I have a C++ object that I'm getting the reference to in my view
I have a view that I am presenting modally. For some reason it animates
HEllo, I have a hybrid iPhone application that has a UITabBarController and 5 Tabs.

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.