Dejell
Dejell

Reputation: 14317

Calling UIViewController method that imports AppDelegate from AppDelegate

I have a BaseViewController that all my UiViewController extend.

This BaseViewController also uses AppDelegate and therefor I import it like this:

@interface BaseViewController : UIViewController{
    AppDelegate *appDelegate;  
}

In AppDelegate, I need to use a method applicationDidBecomeActive. In the method I would like to use a method of BaseViewController.

So I imported the BaseViewController:

#import "BaseViewController.h" but then I get a compilation error in BaseViewController :

Unkown type AppDelegate

What is wrong?

Upvotes: 0

Views: 225

Answers (1)

Vahid Farahmand
Vahid Farahmand

Reputation: 2558

in your .h file, add this line:

@class AppDelegate

at top Then re-try

Upvotes: 1

Related Questions