user2056167
user2056167

Reputation: 21

forward declaration of viewController class receiving illegal interface qualifier error

@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;

@class ViewController;

@property (strong,nonatomic) ViewController *viewController; 

@end

on the line of @class ViewController it says there is an illegal interface qualifier error. What does it mean and how can I fix it?

Upvotes: 2

Views: 5537

Answers (3)

user1105951
user1105951

Reputation: 2287

just one to add for others, that I got also "illegal interface qualifier error" and I was 99% sure it's something with forward declaration..but then..on every time I change and try to fix this,xcode gave very strange errors that was not logical.

finally the problem was : missing @end on other header file..

unlucky...

Upvotes: 14

Brane
Brane

Reputation: 800

Declare

@class ViewController;

prior to

@interface AppDelegate : UIResponder <UIApplicationDelegate>

Upvotes: 10

Chris C
Chris C

Reputation: 3251

You need to put the @class ViewController outside of your @interface, like so:

@class ViewController;
@interface AppDelegate : UIResponder <UIApplicationDelegate>

@property (strong, nonatomic) UIWindow *window;



@property (strong,nonatomic) ViewController *viewController; 

@end

Upvotes: 3

Related Questions