Search code examples
iosxcode4ios4

xcode4 parameter of incompatible type


A project that runs fine on Xcode3, fails to compile on Xcode4 with this error:

file://localhost/users/Ishaq/Projects/game01/libs/cocos2d/CCLayer.m: error: Semantic Issue: Sending 'ccColor4B' (aka 'struct _ccColor4B') to parameter of incompatible type 'CIColor *'

the code that throws this error is below (from cocos2d-iphone CCLayer.m):

+ (id) layerWithColor:(ccColor4B)color
{
     return [[[self alloc] initWithColor:color] autorelease];
}

Somehow Xcode thinks this code is calling - (id)initWithColor:(CIColor *)color; of CIImage (inside CIImage.h). How can I set Xcode's brain straight? ;-)


Solution

  • I've got the same problem. My resolution was to explicitly cast it proper type which helps the compiler to find the proper class. So the code looks like this:

    return [[(CCColorLayer*)[self alloc] initWithColor:color] autorelease];