2013-03-21 23 views
1

獲得上述錯誤: 終止應用程序由於未捕獲的異常 'NSInvalidArgumentException',原因:「+ [CCProgressTimer progressWithSprite:]:無法識別的選擇發送到類0x1a8194[CCProgressTimer progressWithSprite:]:無法識別的選擇發送到類0x1a8194

這裏是我的代碼

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]; 
+1

這cocos2d的版本?你檢查過該方法存在的api引用嗎? – LearnCocos2D 2013-03-21 12:37:05

+0

THanks LearnCocos2d,我如何檢查它?順便說一句,我通過檢查它的庫文件並取代 arrow = [CCProgressTimer progressWithFile:@「arrow_inner.png」]; – iphonemaclover 2013-03-22 05:13:55

+0

請在cocos2d.m或日誌中查看您運行應用的時間 – LearnCocos2D 2013-03-23 00:35:28

回答

-1

我有檢查其庫文件,錯誤原因,因爲沒有方法ProgressWithSprite,代替其具有progressWithFile方法。可能是其因cocos2d的版本問題,因爲由LearnCocos2d提供了幫助, 所以我現在用它和它的做工精細

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

1

progressWithSprite需要CCSprite對象作爲輸入不NSString的。

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

Hello Guru THanks爲了快速響應和努力,我檢查了它的庫文件,錯誤原因是沒有方法ProgressWithSprite,而不是它的progressWithFile方法。所以我現在使用它,它的工作正常 arrow = [CCProgressTimer progressWithFile:@「arrow_inner.png」]; // [CCSprite spriteWithFile:ARROW_INNER]]; – iphonemaclover 2013-03-22 05:16:15

+0

快樂編碼.... – Guru 2013-03-22 05:30:33

+0

你的答案幫助... !!! – iPhoneProcessor 2013-04-07 17:31:46

相關問題