我目前正在試驗各種輸入控件,並且偶然發現了SneakyInput,我正在嘗試使用它。SneakyInput/SneakyButton
不幸的是,當我加入一個SneakyButton(只是一個按鈕)層,並出現以下錯誤消息在整個應用程序崩潰:
+[CCTouchDispatcher addTargetedDelegate:priority:swallowsTouches:]: unrecognized selector sent to class 0xfed9c 2012-01-30 10:00:50.881 OpenSpace[588:1be03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CCTouchDispatcher addTargetedDelegate:priority:swallowsTouches:]: unrecognized selector sent to class 0xfed9c'
我已經撞了我的頭周圍這幾個小時並試圖以很少的喜悅Google解決方案。任何幫助在這裏將不勝感激,爲什麼,它爲什麼會崩潰?
環境:2.0的cocos2d-β,OS X 10.7.2,iOS的5.0
代碼:
-(void) addFireButton {
float buttonRadius = 80;
CGSize screenSize = [[CCDirector sharedDirector] winSize];
fireButton = [[[SneakyButton alloc] initWithRect:CGRectZero] autorelease];
fireButton.radius = buttonRadius;
fireButton.position = CGPointMake(screenSize.width - buttonRadius, buttonRadius);
[self addChild:fireButton];
}
錯誤消息完整:
2012-01-30 10:00:50.684 OpenSpace[588:1be03] cocos2d: cocos2d v2.0.0-beta2
2012-01-30 10:00:50.685 OpenSpace[588:1be03] cocos2d: Using Director Type:CCDirectorDisplayLink
[Switching to process 588 thread 0x1f113]
2012-01-30 10:00:50.763 OpenSpace[588:1be03] cocos2d: animation started with frame interval: 60.00
2012-01-30 10:00:50.766 OpenSpace[588:1be03] cocos2d: surface size: 960x640
2012-01-30 10:00:50.850 OpenSpace[588:1be03] init: <OpenSpace = 093BFAE0 | Tag = -1>
2012-01-30 10:00:50.857 OpenSpace[588:1be03] cocos2d: CCFileUtils: Warning file not found: spaceship-hd.png
2012-01-30 10:00:50.864 OpenSpace[588:1be03] +[CCTouchDispatcher addTargetedDelegate:priority:swallowsTouches:]: unrecognized selector sent to class 0xfed9c
2012-01-30 10:00:50.881 OpenSpace[588:1be03] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[CCTouchDispatcher addTargetedDelegate:priority:swallowsTouches:]: unrecognized selector sent to class 0xfed9c'
*** First throw call stack:
(0x1c4c052 0x21e2d0a 0x1c4dadd 0x1bb2f00 0x1bb2ce2 0xb5438 0x1c4de1a 0x99e19 0x99dba 0x42890 0x345ed 0x1c4de1a 0x99e19 0x99dba 0x42890 0x26edd 0x90d7d 0x921c4 0x2a12db 0x2a11af 0x1c20966 0x1c20407 0x1b837c0 0x1b82db4 0x1b82ccb 0x29fd879 0x29fd93e 0x822a9b 0xb37d6 0x2525)
terminate called throwing an exception[Switching to process 588 thread 0x1be03]
sharedlibrary apply-load-rules all
Current language: auto; currently objective-c
也許這就是爲什麼,從實況到cocos2d的V2.0:CCActionManager,CCScheduler,CCTouchDispathcer(IOS)和CCEventDispatcher(Mac)沒有更長的單身人士。相反,它們是CCDirector的屬性。 – clops 2012-02-01 12:16:54