I had the same problem. In AppDelegate.swift
func applicationWillResignActive(application: UIApplication)
{
let viewControllers = self.window?.rootViewController?.childViewControllers
for vc in viewControllers!
{
if vc.isKindOfClass(GameViewController)
{
let view = vc as! GameViewController
view.comesFromBackground()
}
}
}
And then, in your GameViewController:
func comesFromBackground()
{
let skView: SKView = self.view as! SKView
let scene = skView.scene as! GameScene
scene.comesFromBackground = true
}
Finally, in your GameScene:
override func update(currentTime: CFTimeInterval)
{
if comesFromBackground{
comesFromBackground = false
gameViewController.pauseScene()
}
}
FromBackground .
, , Scene .