Search code examples
iossprite-kittestflightsklabelnode

SKLabelNode never shows up in TestFlight


In my Sprite Kit Game i use several SKLabelNodes ..on most of them I run SKActions. On all kinds of iOS Simulators as well as on a device (iPhone 6) everything works fine. But! ..on all Testflight devices (including some iPhone 6) one Labels never shows up!

How could that be?


Solution

  • I would recommend setting the .name property of the SKLabelNode, along with all of the other nodes in your scene, and testing with some log statements:

    (Let's say you go with: missingLabelNode.name = @"Missing";)

    // make sure the Label Node has been added to the scene
    NSLog(@"%@ label", [self childNodeWithName:@"Missing"].name);
    

    After you're certain, and the Log prints "Missing Label"..

    // Find the coordinates of the Label Node
    NSLog(@"Located at X:%f Y:%f" [self childNodeWithName:@"Missing"].position.x, [self childNodeWithName:@"Missing"].position.y);
    
    // If you've added it to a different layer of the scene, or another node
    NSLog(@"Inside Parent:%@" [[self childNodeWithName:@"Missing"] parent].name);
    

    You should now be certain of it's coordinates and presence in the scene. You can also convert it's position, if it's a child of a node other than the scene itself, by using [self convertPoint:missingLabelNode.position toNode:self] and logging these coordinates.

    Lastly, if you're certain it should be in the visual bounds of the scene, I would check its zPosition. It's very easy to lose a node behind other nodes. Increase the zPosition property to that of the highest index you've set. If you have not set any of the other nodes' zPositions, use missingLabelNode.zPosition = 10.0f; in order to bring it to the top of the node hierarchy.

    This should do the trick.