Creating a new instance of Timer when app enters foreground?
问题 I am creating an app where a timer is set by the user. When the app goes to the background, the timer.invalidate() . Now I want the timer to start again when the app comes back to the foreground. I am creating another instance of timer to do it when the app sends notification that app is in the foreground. However, it's not firing the function. In Viewdidload() I am creating a timer: timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: #selector(handleCountdown), userInfo: