When does the SpriteKit game loop run for the first time?
This isn't directly relevant but might give you a way forward...
SpriteKit tries to do automatic pausing and unpausing when the game goes into the background and back to the foreground. I had a situation where I wanted more control, and in particular did not want the game to always start up again on resume. My hack (which was working on iOS 12 and 13, though I don't recall versions) was to override isPaused
in my derived game scene, e.g.,
override var isPaused: Bool {
get { super.isPaused }
set {
if forcePause && !newValue {
os_log("holding isPaused at true because forcePause is true", log: .app, type: .debug)
}
super.isPaused = newValue || forcePause
}
}
Then I'd have the additional variable forcePause
to keep the game under control.
Perhaps you could do something similar, setting forcePause
when you go into the background and then having applicationDidBecomeActive
clear it. Perhaps that would be sufficient to keep iOS 12 from jumping the gun on you.