Sending 'ccColor4B' (aka 'struct_ccColor4B') to parameter of incompatible type 'CIColor *'

作为一个新手,运行他人的程序build时往往会在

+ (id) layerWithColor:(ccColor4B)color
{
   return [[[self alloc] initWithColor:color] autorelease];    // <- ERROR HERE
}

处出现以下报错:

Sending 'ccColor4B' (aka 'struct_ccColor4B') to parameter of incompatible type 'CIColor *'

google了一下,发现问题在这里:

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

调试,换之,仍不能运行,仍报错:

Use of undeclared'CCLayerColor'

忽然想起来新版本的区别,于是改为:

+ (id) layerWithColor:(ccColor4B)color
{
	return [[(CCColorLayer*)[self alloc] initWithColor:color] autorelease];
}
原文地址:https://www.cnblogs.com/gaoxiao228/p/2475121.html