TommyG
TommyG

Reputation: 4155

error instantiating other view controllers

I am sure this is really dumb, but I just cant seem to understand why am I getting this error. In my project I have a view controller and another class that does some data structuring job (not relevant anyway). I am getting a compilation error: "unknown type name "the view controller"" when trying to instantiate it within my class.

This is my class .h:

#import <Foundation/Foundation.h>
#import <MapKit/MapKit.h>
#import "MyLocationController.h"
#import "GetZip.h"
#import "SecondTab.h"

 @interface DataEngine : NSObject <MyLocationControllerDelegate, MKMapViewDelegate, GetZipcodeDelegate> {

MyLocationController *CLController;
GetZip *getzip;
SecondTab *secondTab; //ERROR IS HERE

}

My view controller .h:

#import <UIKit/UIKit.h>
#import "FirstTab.h"
#import "DataEngine.h"

@interface SecondTab : UIViewController <UITableViewDelegate, UITableViewDataSource> {

IBOutlet UITableView *table1;
NSString *address; 
NSDate *time;
NSDictionary *dataDict;
  DataEngine *fullData;

}

(I omitted all the @synthesis since I dont think they matter...in any case, I do @property (nonatomic, retain) for everything).

Any idea what can go wrong here?

Upvotes: 2

Views: 1270

Answers (1)

Manish Burman
Manish Burman

Reputation: 3079

Why don't you try to forward declare it. Use @class secondTab instead of #import secondTab? It will help avoiding any circular inclusions if thats the problem.

Upvotes: 7

Related Questions