Arbitur
Arbitur

Reputation: 39091

Cocos2d 2.0 error xcode 5.2

for (CCSprite *body in bodyArray) {
    if (CGRectIntersectsRect(snakeHead.boundingBox, body.boundingBox)) {
        [self unscheduleUpdate];
        [self gameOver];
    }
}

This is my code which worked perfectly on xcode4.2 osx 10.6.8, but when I HAD to upgrade to xcode 4.5 this gives me a warning "Local declaration of 'body' hides instance variable" I have no single clue what this means and I have searched for the problem but haven't found any soution. Does anyone here understand this warning?

Upvotes: 1

Views: 83

Answers (1)

Atif Azad
Atif Azad

Reputation: 1294

You have an instance variable named body in your .h file. You have used the same name on the following line too
for (CCSprite *body in bodyArray).

So this warning message means that instance variable body declared in .h file will not used within the scope of your for loop

Upvotes: 1

Related Questions