使用分发配置文件时,Cocos2d项目崩溃

时间:2013-10-29 10:30:51

标签: objective-c cocos2d-iphone cocosbuilder

我已经将ccbi文件用于应用程序的cocos2d动画。

- (void)pressedPlay:(id)sender
{
  CCScene* songScene = [CCBReader sceneWithNodeGraphFromFile:@"SongScene.ccbi"];
  [[CCDirector sharedDirector] replaceScene:songScene];
}

这会加载动画屏幕。它通过连接到xcode在模拟器和实际设备中完美地工作。但是当使用ipa文件(adhoc配置文件)运行应用程序时,它会崩溃。

这是SongScene.m的一部分。

 @implementation SongScene

- (id) init {
    self = [super init];
    if (self) {

      [[CCTouchDispatcher sharedDispatcher] addTargetedDelegate:self priority:0 swallowsTouches:NO];

}
    return self;
}

- (void) didLoadFromCCB
{

starScene = [CCBReader nodeGraphFromFile:@"StarScene.ccbi"];
[self addChild:starScene];

moonScene = [CCBReader nodeGraphFromFile:@"MoonScene.ccbi"];
[self addChild:moonScene];

}

- (void) onEnter
{
    [super onEnter];

    [self schedule:@selector(update:)];

    soundEffectID=[[SimpleAudioEngine sharedEngine] playEffect:@"yyyy.MP3"];

    self.touchEnabled = YES;
  }


- (void) onExit
 {
    [super onExit];
    [[SimpleAudioEngine sharedEngine] stopEffect:soundEffectID];
    [self unscheduleAllSelectors];
 }

0 个答案:

没有答案