iPhone - NSTimer not repeating after fire

前端 未结 8 1815
被撕碎了的回忆
被撕碎了的回忆 2021-02-19 16:14

I am creating and firing a NSTimer with:

ncTimer = [NSTimer scheduledTimerWithTimeInterval:1.0
                                           target:sel         


        
8条回答
  •  生来不讨喜
    2021-02-19 16:33

    I don't know why but Timer.scheduledTimer method is not working but Timer.init method worked.

    self.timer = Timer.init(timeInterval: 10.0, repeats: true, block: { (timer) in
                print("\n--------------------TIMER FIRED--------------\n")
                self.checkForDownload()
            })
    RunLoop.main.add(self.timer!, forMode: RunLoopMode.defaultRunLoopMode)
    

提交回复
热议问题