0

I have used ccbi files for cocos2d animations for the app.

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

This loads the animation screen. It works perfectly in simulator and actual device by connecting to the xcode. But when running the app by using ipa file(adhoc provisioning profile), It crashes.

This is the part of the 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];
 }
Susitha
  • 3,339
  • 5
  • 27
  • 41
  • try to install your app on device using developer account and check which error you got and paste it with your question. – Tirth Oct 29 '13 at 10:47
  • I have run app on device using dev account, it doesn't show any errors. It works perfectly. – Susitha Oct 29 '13 at 11:01
  • check device OS versions may be your library outdated for that device – Tirth Oct 29 '13 at 11:05
  • I have replace CCScene* songScene = [CCBReader sceneWithNodeGraphFromFile:@"SongScene.ccbi"]; with other ccbi file. It works, how can i track the problem with ccbi file. – Susitha Oct 29 '13 at 11:10
  • 1
    Have you tried building a release configuration respectively with optimizations enabled? Often those distribution issues are caused because code sometimes behaves differently when optimizations are enabled. – CodeSmile Oct 29 '13 at 11:13
  • @LearnCocos2D could you tell how this settings can be enable or disable. Thanks – Susitha Oct 29 '13 at 11:19
  • 1
    Edit the scheme and set the configuration to Release. Keep in mind that debugging in release is rather difficult, values in debugger will often be incorrect, stepping through code will skip lines and so on. If this confirms the issue, go into Build Settings and find the "Optimization Level" setting. Take it back one notch and see if the error is gone. If it's gone only when optimization level is set to "None" and your app still runs fine, leave it at that. But such things often speak of an inherent code bug. – CodeSmile Oct 29 '13 at 11:36
  • It works for me. I set the optimization level as "None", Thanks @LearnCocos2D. – Susitha Oct 30 '13 at 06:51

0 Answers0