cocos2d-iphonekobold2d

'itemFromNormalSprite:selectedSprite:target:selector:' is deprecated


Why am I getting this warning and how can I fix it?

I'm using Kobold2D v2.1.0 (Uses cocos2d-iphone v2.1 and OpenGL ES 2.0)

My code:

CCMenuItemSprite *flareButton = [CCMenuItemSprite itemFromNormalSprite:flareSprite selectedSprite:flareSelectedSprite target:self selector:@selector(flareSelected)];

Can you also tell me how I can avoid these deprecations in the future by looking at a reference of any kind. Thanks


Solution

  • Look into ccDeprecated.m - you'll find all deprecated methods there as well as the correct (changed) way to use the function.

    Deprecated in cocos2d means in almost all cases that the name of the function, the parameter list or its location have changed. You can also disable deprecation warnings in Build Settings and just ignore it for at least until the next major cocos2d update.