1

While going through a tutorial which uses a navigation based- application, I decided to create a Navigation-Based Application with my 3.2.6-Xcode and open it with Xcode 4.2 for following the tutorial with that version. But when I open the same project in Xcode 4.2 (without changing or adding any code), the 4.2 Xcode gives me 2 errors saying:

RootViewController cannot use 'super' because it is a root class

Right now, my Xcode has 4 class-files: RootViewController.h, RootViewController.m, SaveUpAppDelegate.h and SaveUpAppDelegate.m. The error is in RootViewController.m:

- (void)dealloc {
    [super dealloc];
}

and

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];

    // Relinquish ownership any cached data, images, etc that aren't in use.
}

I already searched through the internet and found this discussion (http://stackoverflow.com/questions/10113669/xcode-4-3-2-gives-error-cannot-use-super-because-it-is-a-root-class) and they say that the reason might be that the controller is that the developer forgot the superclass in the @interface line. That doesn't fit to my case, because I (or better: Xcode 3.2.6) didn't forget the superclass in RootViewController.h...

#import <UIKit/UIKit.h>

@interface RootViewController : UITableViewController {
}

@end

right now, I commented those critical lines out and it works fine, but I'm sure, I'll need those lines since most of the automatic created lines in the m-file are done with [super ....].

How to solve the problem?

Kirinriki
  • 855
  • 4
  • 12
  • 18
  • 1
    Did you try cleaning the project? – DrummerB May 29 '12 at 11:57
  • sorry for that dumb question, but what do you mean with "cleaning" the project? Delete/Comment all the auto-created code out? - If you mean that: Yes. I commented the critical code out and it works fine now. But I'm not sure if I'll need that super-code during the tutorial. That's why I'm asking if there's another solution or if "super" can be replaced by something other. – Kirinriki May 29 '12 at 11:59
  • did you use ARC (Automatic Reference Counting) ? – CarlJ May 29 '12 at 12:02
  • My project says that there's no Objective-C++ Automatic Reference Counting (it's set to "No") and I also couldn't set some checkbox like that while creating the project via Xcode 3.2.6. – Kirinriki May 29 '12 at 12:05

2 Answers2

4

My resolution was more simple. There was a misspelling in the #import "ClassHere.h" in the .m file. This resolved the issue I had.

AndraD
  • 2,830
  • 6
  • 38
  • 48
Treis
  • 41
  • 1
  • 1
    @Matthias, he means to say that the error that the OP is talking about can also occur when you have a typo in the `#import` statement or `@implementation` definition in the corresponding implementation file, in which case the accepted answer will have no effect. Thanks, for pointing this out, Treis. – uɥƃnɐʌuop Jun 27 '13 at 21:56
2

Clean. It's an option under "Run". It removes all the build files that are automatically generated.

Dancreek
  • 9,524
  • 1
  • 31
  • 34
  • it works pretty fine now. Thanks. I realized that it's no problem to delete all those auto-incremented lines, because in the tutorial, they'll be set again, but with the appropriate lines. – Kirinriki May 29 '12 at 12:52