I have a strange problem. I am using a label node in one of my projects. Last time i was adding a custom font and from that moment my label nodes are not working properly. If I set a Font to my label (like in example under this text), label just won't appear on screen, but app works ok. When clicking to button start game, it also takes a while to load game view ( I guess that font is loading?):
label1 = [SKLabelNode labelNodeWithFontNamed:@"Arial"];
But if I don't set any Font to my label, App just crashes and i get a warning:
*** Terminating app due to uncaught exception 'Attemped to add nil node', reason: 'Attemped to add nil node to parent: <SKScene> name:'(null)' frame:{{0, 0}, {568, 320}}'
I have read lots of posts here from people having problems with fonts. But I just can't find any similar.
Code where error appears (calling a function to stopwatch node to view):
-(void)addStopwatch
{
stopwatch.position = CGPointMake(self.frame.size.width/16,self.frame.size.height);
stopwatch = [SKLabelNode labelNodeWithFontNamed:@"Arial"];
stopwatch.fontSize = 25;
stopwatch.fontColor = [UIColor whiteColor];
stopwatch.text = [NSString stringWithFormat:@"%s","00:00"];
stopwatch.name = @"stopW";
[self addChild:stopwatch];
}
stopwatch sprite is declared in .h file:
SKLabelNode* stopwatch;