CCLabelTTF not working in iOS 6.1

576 views Asked by At

I am using cocos2d v0.99.5 and iOS deployment target is 5.0

when i run my app with Xcode 5.0 in iOS-7.0/5.0 simulator it is working fine. and i run with Xcode 5.0 in iOS-6.1/6.0 simulator not working. i checked with breakpoint, it is crashing at the below code:

CCLabelTTF *mainGameTitle = [[CCLabelTTF alloc] initWithString:@"REGULAR PACK" dimensions:CGSizeMake(40, 50) alignment:UITextAlignmentLeft fontName:@"Arial Rounded MT Bold" fontSize:20];

and it shows like this:

enter image description here

When i write:

CCLOG(@"font names ====> %@",[UIFont familyNames]);

In this line also "EXC_BAD_ACCESS" error occur in iOS-6.0 and 6.1.

I tried with CCMenuItemFont, this one also shows the above crash.

it is Working in 7.0 and 5.0 simulator/device. What is this issue? please help me?

Edit:

I tried with another method i.e

 CCLabelTTF *mainGameTitle = [CCLabelTTF labelWithString:@"REGULAR PACK" fontName:@"Arial Rounded MT Bold" fontSize:20];

again i got same above UIFont issue in labelWithString:fontName:fontSize method.

2

There are 2 answers

2
Kirit Modi On

you use the CCLabelTTF method that is already Deprecated.see below screen shot

enter image description here

0
Raviraj Jadeja On

Deprecated method states that below the particular version this won't work, not specifically in this method but in several method it is supportive and not supportive due to change in operating system and the functional flow of data.

You could try below method which would work on both platform

CCLabelTTF *label1 = [CCLabelTTF labelWithString:@"Hello World 1" fontName:@"Marker Felt" fontSize:50];

Thanks