将旧的Cocos2d项目转换为ARC时的前向声明错误

时间:2013-04-12 18:12:34

标签: ios objective-c cocos2d-iphone automatic-ref-counting

当我尝试将旧的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

0 个答案:

没有答案