I am creating a game that has players swiping the planes into the correct lanes. However, I recently added a airplane to my game screen. However, Xcode says that I am using and undeclared identifier. I am new to this so please help.
Here is my header file controlling the game.
GamePlayViewController.h
#import <UIKit/UIKit.h>
@interface GamePlayViewController : UIViewController
@end
Here is my GamePlayViewController.m This is where the error appears.
#import "GamePlayViewController.h"
#import "Airplane.h"
@interface GamePlayViewController ()
@end
@implementation GamePlayViewController
-(void) viewWillAppear:(BOOL)animated {
//Add a vehicle
Airplane* v = [[Airplane alloc]
initWithFrame:CGRectMake(221, 228, 0, 0)
[self.view addSubview:v];
}
@end
The error is at the Airplane* v [[Airplane alloc]. It says Use of undeclared identifier "Airplane" and also "v"
I have searched all over Google and Stackoverflow for the answer, but none of the scenarios matched my situation.
By the way, thanks in advance to whoever answers.
Where do you declare image from this line?
image = [loadedImage retain];
my guess is you don't.
Add this:
@property (nonatomic, retain) UIImage *image;
...to your .h, and this to your .m:
@synthesize image;