This is for my swift based sprite kit game. It was fine on iOS 8, but i notice this delay after I started to run the game on an iOS 9 device. Before my game goes back into the game scene from a menu or some other view that was presented, there's this one to two seconds of delay after the dismiss button is clicked in one of those views.
I dismiss the views with this code:
self.dismissViewControllerAnimated(true, completion: nil)
To solve this problem, I tried running the code inside the main dispatch queue. It didn't help.
dispatch_async(dispatch_get_main_queue()) {
self.dismissViewControllerAnimated(true, completion: nil)
}
Checked if there's anything in my game view loaded methods that might cause a delay but looks good. The code doesn't have issues in iOS 8 anyways.
Anybody had a similar problem and perhaps fixed it?
EDIT: Realized that the game scene starts executing already and by the time my view is dismissed, i can see the animations are already playing. Example, a 3 seconds animation is already in mid way completion.
EDIT 2: This issue does not happen on iOS 9 with iPhone 4s but happens with later versions, in my case with iPhone 6. It could be the new Metal rendering causing this. 4s doesn't have Metal. New iOS patch didn't get this fixed as well.
EDIT 3 Same lag happens when using two SKViews as well. To get rid of UIControlView to SKView transition lag, I tried to replace my UIView, it's controls and UIControlView with another SKScene. Even when I set the transition time to zero seconds, there's a delay when the SKView gets dismissed. This time lag happens both ways, so it's worse. Current version iOS 9.2, Xcode 7.2.