UberJump Tutorial Error

I’m using Ray Wenderlich’s tutorial called UberJump (https://www.raywenderlich.com/87232/make-game-like-mega-jump-sprite-kit-swift-part-2) and I’ve run into a logic error. The code used to remove objects is not working and I can’t figure out why. I downloaded his source code and his code is not working either.

Here is what I’m having trouble with:

     override func update(currentTime: NSTimeInterval) {

    //new max height?
    //1
    if Int(player.position.y) > maxPlayerY {
        //2
        GameState.sharedInstance.score += Int(player.position.y) - maxPlayerY!
        //3
        maxPlayerY = Int(player.position.y)
        //4
        lblScore.text = String(format: "%d", GameState.sharedInstance.score)
    }


    // Remove game objects that have passed by
    foregroundNode.enumerateChildNodesWithName("NODE_PLATFORM", usingBlock: {
        (node, stop) in
        let platform = node as! PlatformNode
        platform.checkNodeRemoval(self.player.position.y)
    })

    foregroundNode.enumerateChildNodesWithName("NODE_STAR", usingBlock: {
        (node, stop) in
        let star = node as! StarNode
        star.checkNodeRemoval(self.player.position.y)
    })


    //calculate player y offset

    if player.position.y > 200.0 {
        backgroundNode.position = CGPoint(x: 0.0, y: -((player.position.y -   200.0)/10))
        midgroundNode.position = CGPoint(x: 0.0, y: -((player.position.y - 200.0)/4))
        foregroundNode.position = CGPoint(x: 0.0, y: -(player.position.y-200.0))
    }
}

The “remove game objects that have passed by” code is not working. It is supposed to remove the platforms as the character jumps on them. Did I write the code out wrong? Thanks.

That resembles the code in the tutorial.

Can you clarify what you mean by ‘not working’? Is the code crashing, or are the platforms just not disappearing when you think they should? Check the following: Do the platforms definitely have the name “NODE_PLATFORM”? Is the code in that closure being called (set a breakpoint and check). Have you written the ‘checkNodeRemoval’ function correctly?