6
votes

I'm getting this error: "Cannot find interface declaration for 'BaseViewController', superclass of 'ViewController'. Here's the situation:

AppDelegate:

  • Subclass of NSObject
  • In the header file:

    #include UIApplicationDelegate

BaseViewController

  • Subclass of UIViewController
  • In the header file:

    #import "AppDelegate.h"

ViewController

  • Subclass of BaseViewController

    #import "BaseViewController.h"

The error doesn't make sense, as BaseViewController is imported in ViewController's header file. What is the problem here?

3

3 Answers

26
votes

Also check for infinite loops in your import statements

10
votes

Try adding

#import <UIKit/UIKit.h>
6
votes

Cannot find interface declaration for 'BaseViewController'

That error means that the compiler can't find the line that looks like this:

@interface BaseViewController : UIViewController

But I think it CAN find the BaseViewController.h (Or it would complain about that specifically)

I'd check that the spelling is the same including upper/lowercase?

Other than that, it should work as you'd expect.