This should be an easy question – but I’m having a hard time figuring it out. I’m trying to create a property on an object so that during prepareForSegue I can tell the object what it’s delegate is. I know I could do this with protocols but I figured for this case a direct approach would be simplest. Unfortunately, the following code results in a compiler error:
#import <UIKit/UIKit.h>
#import "PlanningViewController.h"
@interface DepartmentViewController : UITableViewController
@property (nonatomic, weak) PlanningViewController *planningDelegate;
@end
When I type the property declaration, Xcode recognizes PlanningViewController and even displays the text for me to just tab through. The compiler, though, complains with:
Unknown type name 'PlanningViewController': did you mean 'UISplitViewController'?
What am I doing wrong?
PlanningViewController.h looks like this:
#import <UIKit/UIKit.h>
#import "DepartmentViewController.h"
@interface PlanningViewController : UITableViewController
// Table cell connections
- (IBAction)addItemPressed:(id)sender;
@end
Remove this line from your
PlanningViewController.hheader file:You have something of a loop in your header files.
Better still, make
DepartmentViewController.hlook like this (there is no need to includePlanningViewController.hin your header file):