Search code examples
cocos2d-iphonexcode4.5cocos2d-extensions-ios

Cocos2D iPhone Extensions v0.2.1: CCMenuAdvanced warning: CCMenu may not respond to initWithItems:vaList: Should I be concerned?


Looked in the CCMenu.h and it looks like it responds to the exact method Xcode (4.5.2) is saying it doesn't respond to. I've tried overriding the method and extending CCMenu, but it always throws the same message.

When I build and run my project, it seems to work fine. Should I ignore this warning and continue with my game? Another question: Is there a simple way to 'update' this code to a non-deprecated or outdated method? Here's the cocos2d-iphone-extensions version I'm using. Also, it's cocos2d 2.1.

The error is generated on line 76 of the .m file.

CCMenuAdvanced.h:

https://github.com/cocos2d/cocos2d-iphone-extensions/blob/master/Extensions/CCMenuAdvanced/CCMenuAdvanced.h

CCMenuAdvanced.m:

https://github.com/cocos2d/cocos2d-iphone-extensions/blob/master/Extensions/CCMenuAdvanced/CCMenuAdvanced.m


Solution

  • You are getting this warning because -(id) initWithItems: (CCMenuItem*) item vaList: (va_list) args is not present in the header file (CCMenuAdvanced.h).

    You need to use + (id) menuWithItems: (CCMenuItem*) firstItem vaList: (va_list) args; from CCMenu (superclass of CCMenuAdvanced).