I understand the differences between the two methods, but I was wondering if there are flaws in using UIApplicationWillResignActive, and not UIApplicationDidBecomeActive (or UIApplicationDidEnterBackground) when you do something like pause SpriteKit. I drove past the threads on the site and noticed that usually in response to questions about how to pause SpriteKit, UIApplicationDidBecomeActive and UIApplicationDidEnterBackground are suggested, not UIApplicationWillResignActive. Since UIApplicationWillResignActive also pauses games in response to Siri / Calls, wouldn’t this be the best way to use SpriteKit when pausing games, etc. Or is there any drawback to using it?
Below I have a notification and pause function:
NotificationCenter.default.addObserver(self, selector:
NotificationCenter.default.addObserver(self, selector:
Pause Function:
func pauseGame(){
print(self.scene?.isPaused)
if sceneIsPaused == true || isGameOver == true{
return
}
leftMobGenTimer.invalidate()
rightMobGenTimer.invalidate()
genDragonTimer.invalidate()
checkNinjaTimer.invalidate()
chiStrikeTimer.invalidate()
randCoinTimer.invalidate()
print("Timer stopped?")
if soundEnabled == true{
player.pause()
}
self.scene?.isPaused = true
sceneIsPaused = true
makePauseView()
}