"expected type" while implementing delegate
appdelegate, ios, objective-c
Solution
Add the following at the top. Since the protocol `TopBarDelegate` is defined above the class `TopBarViewController`, at the point you define the protocol, the compiler doesn't know there is a class called `TopBarViewController`. This line tells it there really is a class with that name defined somewhere.
@class TopBarViewController;
Problem
I am writing just a piece of code, but taking an error that "expected type @line - (void)backButtonTapped:(TopBarViewController *) topBarViewController; What is wrong with this? ``` @protocol TopBarDelegate - (void)backButtonTapped:(TopBarViewController *) topBarViewController; @end @interface TopBarViewController : UIViewController { } @property (assign, nonatomic) id <TopBarDelegate> delegate; -(void) backButtonPressed:(id)sender; -(void) menuButtonPressed:(id)sender; @end ```