Note that there are some explanatory texts on larger screens.

plurals
  1. POiPad App Crashing with NSInvalidArgumentException
    primarykey
    data
    text
    <p>I am trying to make my first cocos2d, chipmunk ipad app</p> <p>I set a "ball" sprite in my .h file like this:</p> <pre><code> // HelloWorld Layer @interface HelloWorld : CCLayer { cpSpace *space; CCSprite *ball; } </code></pre> <p>and I am moving it like this (upon a touch):</p> <pre><code>- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { for( UITouch *touch in touches ) { CGPoint location = [touch locationInView: [touch view]]; location = [[CCDirector sharedDirector] convertToGL: location]; // Determine speed of the target int minDuration = 2.0; int maxDuration = 4.0; int rangeDuration = maxDuration - minDuration; int actualDuration = (arc4random() % rangeDuration) + minDuration; // Create the actions id actionMove = [CCMoveTo actionWithDuration:actualDuration position:ccp(location.x, location.y)]; id actionMoveDone = [CCCallFuncN actionWithTarget:self selector:@selector(spriteMoveFinished:)]; [ball runAction:[CCSequence actions:actionMove, actionMoveDone, nil]]; [ball retain]; } } </code></pre> <p>When I run with the debugger I get this:</p> <pre><code>2011-06-29 20:44:04.121 ballgame[3499:207] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[HelloWorld spriteMoveFinished:]: unrecognized selector sent to instance 0x605a3e0' </code></pre> <p>It appears to work for a couple touches and then it seems to crash, so perhaps its memory leak? Any suggestions or advice would really help, this is like my first app.</p> <p>Cheers!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload