--EDITED WITH UPDATED INFORMATION--
What I wish to do is call a function named timerFunc
once every five seconds using a NSTimer.scheduledTimerWithTimeInterval
method, the issue seems is that during runtime, I get the error
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-
[Animation.ViewController timerFunc:]: unrecognized selector sent to instance 0x7fe548d66040'
In the output log. I've been looking up other people's NSTimers to no avail, I see quite a few have the selector as selector: Selector("timerFunc:")
instead of selector: Selector("timerFunc")
both ways, however, give the error. Another thing is that both the timerFunc function and the NSTimer are inside of viewDidLoad, are there any issues with that? Any insight on the problem is greatly appreciated, thanks for reading.
timerFunc below
func timerFunc(){
println("Timer")
}
NSTimer below
NSTimer.scheduledTimerWithTimeInterval(
5.0,
target: self,
selector: Selector("timerFunc"),
userInfo: nil,
repeats: true)