1
votes

Getting above error: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CCProgressTimer progressWithSprite:]: unrecognized selector sent to class 0x1a8194

here is my code

arrow_base = [CCSprite spriteWithFile:ARROW_OUTER]; arrow_base.position = ccp(m_pBullet.position.x,m_pBullet.position.y);

    arrow = [CCProgressTimer progressWithSprite:@"arrow_inner.png"];//[CCSprite spriteWithFile:ARROW_INNER]];

    arrow.type=kCCProgressTimerTypeHorizontalBarLR;

    //arrow.type = kCCProgressTimerTypeBar;
   // arrow.midpoint = ccp(0,0.5);
    arrow.position = ccp(m_pBullet.position.x,m_pBullet.position.y);
    arrow.percentage = 100;

    [m_pBulletCover addChild:arrow_base];
    [m_pBulletCover addChild:arrow];
2
which cocos2d version? Have you checked the api reference that the method exists? - LearnCocos2D
THanks LearnCocos2d,how i check it? by the way i figure it out by checking its library file and replacing arrow = [CCProgressTimer progressWithFile:@"arrow_inner.png"]; - 9to5ios
look in cocos2d.m or the log whenever you run the app - LearnCocos2D

2 Answers

1
votes

progressWithSprite takes CCSprite object as input not NSString.

    arrow = [CCProgressTimer progressWithSprite:[CCSprite spriteWithFile:@"arrow_inner.png"]];
-1
votes

i have check its library file,the error cause as there is no method ProgressWithSprite, instead of that its having progressWithFile method. May be its due to Cocos2d version problem as help provided by LearnCocos2d, So i use it now and its working fine

arrow = [CCProgressTimer progressWithFile:@"arrow_inner.png"];