unrecognized selector sent to class 0x1011406d0

  1. 4 years ago
    Edited 4 years ago by Haox

    Hi everybody.
    I'm making a game with a timer. The timer is written in GameScene.swift and I want to invalidate it AND start it again from an UIButton in the GameViewController.swift.
    To that I'm using a class func to reach the startTimer function in GameScene :

    My GameViewController.swift :

    class GameViewController: UIViewController {
            override func viewDidLoad() {

    My GameScene.swift :

    var timerCount: NSTimer? = nil
    class GameScene : SKScene {
              class func startTimer(dt:NSTimer) {
                        timerCount = NSTimer.scheduledTimerWithTimeInterval(1.0 , target: self, selector: Selector("updateTimer:"),  userInfo: nil, repeats: true)
              func updateTimer(dt:NSTimer){
                      if counter<0{
                      } else{
                          labelCounter.text = "\(counter)"

    My problem is in the target and selector of scheduledTimerWithTimeInterval method.
    When I use breakpoint here, it will never go to the next step : func updateTimer(dt:NSTimer){} and I have this error : [Funfair_balloon.GameScene updateTimer:]: unrecognized selector sent to class 0x1011406d0

    Someone can help me?

    Thanks a lot !!

or Sign Up to reply!