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

I have a few custom UIViewControllers in my app which need to know the
So I'm building an app and I am running through a few ViewControllers that
Few users of my Flex 4.6 web application are complaining, that the mx.controls.PopUpButton at
I'm writing an app (in iOS 5 using ARC!) that presents several hundred objects
The original version of my app contains a UITableViewController that is pushed onto the
in my app, an NSMutableArray is populated with an object in viewDidLoad (eventually there
I have a class called 'Constants' that I am storing a String variable in.
I have a UIViewController that needs to set a few labels when it receives
I'm working on my first iPhone app and have been able to get most
I've got a a few UIScrollView on a page. You can scroll them independently

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.