Unrecognized selector sent to instance NSTimer Swift

后端 未结 3 1661
轮回少年
轮回少年 2021-01-05 08:35

I\'m trying to developing an app that includes a simple Stopwatch feature. I\'m using Xcode 6 and the Swift language. Here is the code in FirstViewController



        
3条回答
  •  失恋的感觉
    2021-01-05 09:11

    let updateTime be a class method .
    And if it's in a pure Swift class you'll need to preface that method's declaration with @objc like:

    class A {
         @objc func updateTime(timer:NSTimer) {
    
         }
    }
    

提交回复
热议问题