【发布时间】:2021-08-29 19:04:51
【问题描述】:
我尝试在 Swift 中构建一个秒表,它可以工作,但是当你退出应用程序时它会停止计数,并且只有在你重新打开它时才会继续。我用过:
Timer.scheduledTimer(timeInterval: 1.0, target: self, selector: #selector(stopwatchFunction), userInfo: nil, repeats: true)
有没有什么方法可以让秒表在应用关闭的情况下继续计数?
【问题讨论】: