RootViewController cannot use 'super' because it is a root class
Question
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?
Solution
Clean. It's an option under "Run". It removes all the build files that are automatically generated.
OTHER TIPS
My resolution was more simple. There was a misspelling in the #import "ClassHere.h" in the .m file. This resolved the issue I had.