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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:10:46+00:00 2026-05-15T00:10:46+00:00

A few UIViewControllers in my app that need to register with a provider class

  • 0

A few UIViewControllers in my app that need to register with a “provider” class in their viewDidLoad methods. I’ve just been adding them to an NSMutableArray contained in the provider class.

However, I don’t want this NSMutableArray to keep them from being dealloc’ed, and I also want to have them remove themselves from the NSMutableArray in their dealloc methods.

I tried just issuing a [self release] after adding them to the array, and this works, but in order to avoid a crash when they get dealloc’ed, I have to issue a [self retain] right before I remove them. It seems like I’m doing something horribly wrong by retaining an object in it’s own dealloc method.

Is there a better way to store these values?

  • 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-15T00:10:47+00:00Added an answer on May 15, 2026 at 12:10 am

    You just can’t do it the way you want because you would have a circular dependency. You cannot dealloc an object that is in an NSArray.

    You’ll need to have them explicitly remove themselves from the array at some point in their life cycle, or just leave them there and let them get deallocated when the array gets deallocated.

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

Sidebar

Related Questions

A few years ago, I read a book that described how you could override
A few years ago I developed a web app for which we wanted to
Few of us would deny the awesomeness of debuggers, but to make it more
Few months ago, I have came across a Silverlight tutorial of Eric Cartman (South
A few weeks ago, I was assigned to evaluate all our programmers. I'm very
A few months back my team switched our source control over to Apache Subversion
Every few days VS2008 decides to get mad at me and fails to generate
A few years ago we started playing around with XForms from the W3C for
A few questions on MS Access databases - Size: Are there limits to the
In few months I start a project in PHP and I am hesitating to

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.