CCLabelTTF::labelWithString crashes randomly
- Posts: 54
My game crashes with
CCLabelTTF* label = CCLabelTTF::labelWithString(“No Internet Connection.”, CCSize(100,100), CCTextAlignmentCenter, “Thonburi”, 20);
but when i modify the string, it works.
(in android only)
- Posts: 1901
- Location: Xiamen, China
What you said means that, the crash is something about the content of the string.
It is so strange.
- Posts: 171
to Leo Lou:
are you sure it works when you modify that string?
i have tested this on g7.
and it worked well when the font is Marker Felt, but failed when the font is Thonburi, although i modified the string.
maybe Thonburi is not supported by android
- Posts: 11
This happens a lot, and often crashes at seemingly different spots, always one of three.
The arrayMakeObjectsPerformSelector area,
a CCTouch callback,
or somewhere on the label creation.
If you allocate a lot of labels, or your scenes have them in general, chances are you’ll crash a lot. I can run for 5 min. sometimes and 1 second other times.
It’s hard to trace since it’s usually buried in system calls after setNextScene, within the touches callbacks. Now, any good tutorials on using a BMFont? The official cocos2d tutorial (not 2d-x) tries, but their grammar states “A or B, A is outdated, let’s use A”.. anywho, seems to be “the fix” for those