For this reason application crash [NSConcreteValue boundingBox]: unrecognized selector sent to instance 0x12ecca40

I am working with cocos2d 3.x and Xcode 5.1.1. And I am trying to get the position of CCSprite while touchBegan using CCRectContainsPoint function. I am getting the above error, here is my encoding. Here checkpt is an NSMutable Array and it has CCSprite, thanks in advance.

-(void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
    for(CCSprite *chekPt_copy in _checkpt )
    {
        if(CGRectContainsPoint(chekPt_copy.boundingBox, touchLoc))
        {
            [self removeChild:chekPt_copy cleanup:YES];
            score_inc++;
            [self renew_sprite];
        }
    }
}

      

+3


source to share


1 answer


Having the same problem as me, I finally realized that my NSMutableArray contains no sprites. Check if NSMutableArray "_checkpt" actually has sprites or how in my case NSMutableArray was holding NSObjects for which I had to change the change to check the Sprite NSObject property to resolve the issue.



0


source







All Articles