Domanda

I'm not sure what I did - I was coding away merrily.. I think it might have something to do with updating Xcode to 4.1.1, but all of a sudden, when I build and run my project, the following compiler warning shows up in about 20 different cocos2d modules..

'format specifies unsigned int but the argument has ['CCTimer'] (or whatever module it's in)

the line in question in the cocos2d module is:

return [NSString stringWithFormat:@"<%@ = %08X | target:%@ selector:(%@)>", [self class], self, [target class], NSStringFromSelector(selector)];

and it's the '%08X' that's causing the problem..

And since this error, I can't compile on my iphone, although it runs fine in the simulator. I updated my phone OS to the latest, but it didn't help..

Has anyone else had this?

È stato utile?

Soluzione

That's one of many format strings in cocos2d trying to print out the pointer value. While %08X works the correct way to do this is to use %p. So you can change the line to this:

[NSString stringWithFormat:@"<%@ = %p | target:%@ selector:(%@)>", [self class], self, [target class], NSStringFromSelector(selector)];

You will have to change all these lines, there's about a dozen or so of them.

Example output for anyone curious what the difference looks like:

%08X: 0976DC80
%p:   0x976dc80

PS: I have recently fixed all these incorrect cocos2d logs in Kobold2D.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top