I’m getting an error in an iOS App with Cocos2d. Here it is.
First, I create a Label:
CCLabelTTF *_alertaGC;
...
...
_alertaGC = [CCLabelTTF labelWithString:@"" fontName:@"Marker Felt" fontSize:16];
_alertaGC.color = ccc3(0, 0, 0);
_alertaGC.position = [self convertiPad:ccp(110, 220)];
_alertaGC.anchorPoint = CGPointMake(0.5f, 0.5f);
[self addChild:_alertaGC z:100];
Pressing a button, I change the string of that label:
...
_alertaGC.string = NSLocalizedString(@"LogFirst", @"Logueate primero");
...
But I’m getting an error when pressing the button. It just happens since I Updated Cocos2d from 0.99 to 2.0rc… So I think something has changed, o something is wrong. It has to be something stupid, but I don’t get it…
Here is the log:
2012-06-12 04:01:53.343 AwNoth[2286:707] *** Terminating app due to uncaught
exception 'NSInvalidArgumentException', reason:
'+[CCLabelTTF labelWithString:dimensions:fontName:fontSize:]: unrecognized selector
sent to class 0xff6ec'
*** First throw call stack:
(0x330f388f 0x35098259 0x330f692f 0x330f5915 0x33050650 0xb020f 0xae2ff 0x330521fb 0x39129 0x36649 0x34271 0x3304d3fd 0x80923 0x80fd1 0x7f569 0x3561492b 0x35614319 0x355fa695 0x355f9f3b 0x3319722b 0x330c7523 0x330c74c5 0x330c6313 0x330494a5 0x3304936d 0x33196439 0x35628cd5 0xa7c4b 0x2ef8)
terminate called throwing an exception(lldb)
Thank you!
Notice that version 2.0rc is considered unstable for now. I do not have this version but I advise you to simply look in the source code of CCLabelTTF and see how the class methods are declared.