当我尝试将旧的cocos2d项目更新为arc时出现以下错误:
接收者类型'AppDelegate'例如消息是前向声明
·H
#import "AppDelegate.h"
@interface TimeAttackGame : CCLayer <NSObject> {
AppDelegate *delegate;
}
@end
的.m
delegate = (AppDelegate *)[[UIApplication sharedApplication] delegate];
playerNameLabel = [[CCLabelBMFont labelWithString:[delegate getPlayersName]] fntFile:[NSString stringWithFormat:@"myriadProBold20.fnt"]];
更新完整的.h文件
#import <Foundation/Foundation.h>
#import "cocos2d.h"
#import <iAd/iAd.h>
#import "AppDelegate.h"
@interface TimeAttackGame : CCLayer <NSObject> {
CCSprite *headerPlayerScore,
*headerBannerBG;
NSMutableArray *questionBodyHolder,
*questionSubjectTypeHolder,
*answerAHolder,
*answerBHolder,
*answerCHolder,
*answerDHolder,
*answerEHolder,
*questionHeaderHolder,
*correctAnswerHolder,
*scoreCycleArray,
*scoreCycleTitleArray,
*lineBreakArray;
AppDelegate *delegate;
};
@property (strong, nonatomic) NSMutableData *responseData;
// returns a CCScene that contains the HelloWorldLayer as the only child
+(CCScene *) scene;
-(void)pauseGame;
-(void)resumeGame;
@end