I am importing File "FieldActivityViewController.h".But Showing an error
"/Users/rupeshnandha/Downloads/AQMD Release 3/Classes/InputChoice.h:22:0 Expected specifier-qualifier-list before 'FieldActivityViewController' in /Users/rupeshnandha/Downloads/AQMD Release 3/Classes/InputChoice.h"
As is a code Written in "InputChoice.h"
#import "FieldActivityViewController.h"
@protocol InputChoiceProtocol <NSObject>
@required
-(void) inputChoiceSelectedIndex :(int) index;
@end
@interface InputChoice : UIViewController {
//NSString *keyString;
FieldActivityViewController *field_act;
NSMutableArray *selectionArray;
开发者_运维百科 IBOutlet UITableView *table;
NSObject<InputChoiceProtocol> *delegate;
// IBOutlet UIPickerView *picker;
}
@property (nonatomic,retain) NSArray *selectionArray;
@property (nonatomic,retain) FieldActivityViewController *field_act;
@property (nonatomic,retain) NSObject<InputChoiceProtocol> *delegate;
@end
It's not the good practice to import the application classes in .h files.
Try with forward class declaration and import you FieldActivityViewController
file in .h
Use with forward class declaration @class FieldActivityViewController;
at the place of your import
statement.
use @class FieldActivityViewController
Most likely cause is that you have a circular dependency. InputChoice.h
imports FieldActivityViewController.h
and FieldActivityViewController.h
imports InputChoice.h
(not necessarily directly).
The best solution is to move the imports out of the header file into the .m
file and put
@class FieldActivityViewController;
in InputChoice.h
and
@class InputChoice
in FieldActivityViewController.h
(or whichever header has InputChoic.h
in it.
精彩评论