@property failing, what's wrong?
So, I have a class called Stone. In Stone.h i have those lines:
@interface stone : CCNode <CCTargetedTouchDelegate> {
GameLayer *theGame;
}
@property(readwrite,nonatomic, retain) GameLayer *theGame;
@property(readwrite,nonatomic,retain) CCSprite *mySprite;
and my Stone.m
@implementation Stone
@synthesize theGame,mySprite;
This is all relevant code. But the compiler says - no declaration of property theGame and mySprite found in the interface. And to make it worse this is a book example, what am I doing wrong? I checked code it is exactly the same as in book.
Why is it not seeing the declaration of properties in .h file? #import statement is there.
I thought it was pointer issue, but it is not seeing properties for pure ints too -
@property(readwrite, assign) int stoneType;
fo开发者_JAVA百科r example returns same error.
Lowercase 'stone' in your @interface, uppercase 'Stone' in your @implementation.
Change 'stone' here:
@interface stone : CCNode <CCTargetedTouchDelegate> {
GameLayer *theGame;
}
@property(readwrite,nonatomic, retain) GameLayer *theGame;
@property(readwrite,nonatomic,retain) CCSprite *mySprite;
To Stone:
@interface Stone : CCNode <CCTargetedTouchDelegate> {
GameLayer *theGame;
}
@property(readwrite,nonatomic, retain) GameLayer *theGame;
@property(readwrite,nonatomic,retain) CCSprite *mySprite;
First you should write Stone (uppercase) after Interface.
Second, there is no variable "mySprite" in your interface.
精彩评论