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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:38:00+00:00 2026-06-09T15:38:00+00:00

I have these 3 classes: @interface BaseViewController : UIViewController @interface BaseWebViewController : BaseViewController @interface

  • 0

I have these 3 classes:

@interface BaseViewController : UIViewController
@interface BaseWebViewController : BaseViewController
@interface SecondaryWebViewController : BaseViewController

In AppDelegate, I am setting the rootViewController to be BaseWebViewController which will never be de-alloced throughout the entire lifetime of the app. In BaseWebViewController, I am calling [super viewDidLoad] and [super dealloc] in their respective methods.

Throughout most of the app, the user will be navigating through the UIWebView found on BaseWebViewController. But on certain links, I need to push (and later, pop out of) SecondaryWebViewController.

My question is that since both BaseWebViewController and SecondaryWebViewController are subclassing the BaseViewController, I’m not sure what to do regarding calling [super viewDidLoad] and [super dealloc] in SecondaryWebViewController.

In SecondaryWebViewController, I had been calling those [super viewDidLoad] and [super dealloc], but I noticed it caused some problems especially with random crashes when calling [super dealloc]. Since BaseWebViewController must always be present throughout the entire lifetime of the app, I don’t ever want dealloc called on the BaseViewController.

Sorry, if this sounds confusing, but essentially, the flow looks like this:

  1. AppDelegate sets rootViewController to BaseWebViewController
  2. BaseWebViewController’s viewDidLoad also calls the superclass BaseViewController’s
    viewDidLoad
  3. Majority of the lifetime of the app is spent in
    BaseWebViewController, but occassionally SecondaryWebViewController
    needs to be pushed
  4. SecondaryWebViewController’s viewDidLoad and dealloc calls the superclass’s viewDidLoad and dealloc causing strange behaviour.

Currently, if I comment out [super viewDidLoad] and [super dealloc] in SecondaryWebViewController so that BaseViewController is never dealloced, then everything runs fine. However, I don’t know if this is the right way of doing things.

What is the approach of calling super functions in a subclass such as this scenario?

  • 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-09T15:38:02+00:00Added an answer on June 9, 2026 at 3:38 pm

    If I understood you correctly you are mixing the concepts of Classes and Objects.

    By your description, you have two view controllers objects in your app. One of them is an instance of the BaseWebViewController class and the other is an instance of the SecondaryWebViewController class.

    These two instances are completely separate from each other.

    When your instance of SecondaryWebViewController calls dealloc, when it calls [super dealloc] this just invokes the dealloc method of the BaseWebViewController class – On the same instance. The other view controller instance is completely unaffected.

    I might have completely misunderstood, and in that case please excuse me. If I did understand correctly, you should look up the concepts of classes and objects, this is really important basis for going on further.

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

Sidebar

Related Questions

I have two classes SccmAction and TicketAction which both implement interface IDelivery. These classes
I have an interface called ICommand from which various classes inherit. These classes all
I have an interface (say Employee) which has 2 classes that implements it (say
Ok so I have these 2 classes class Interface < ActiveRecord::Base belongs_to :hardware end
I have some classes that all implement the same Java interface, which essentially allows
I have 2 classes: AppDelegate and ViewAddFriendsWindowObject. In AppDelegate.m i have these lines of
I have these classes and I'm using a Repository pattern and trying to get
I have these classes. class Author{ Person person } class Person{ String lastName String
I have these classes in C# (.NET Framework 3.5) described below: public class Base
I have these classes: class Base { ... private: std::vector<X> v; }; class Derived

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.