I tried to search everywhere in the code:Explained documentry what it does when going to background, or if it is even paused sometime, but to no avail- can someone direct me
I was wondering why in the world this seemingly simple solution was causing me crashes on app startup, but it was because I had iAd running.
So, a thing to keep in mind: @MassivePenguin's answer works but if you have iAd going you will have to grab the SKView via the subviews or it (obviously) crashes.
-(SKView*)getSKViewSubview{
for (UIView* s in self.window.rootViewController.view.subviews) {
if ([s isKindOfClass:[SKView class]]) {
return (SKView*)s;
}
}
return nil;
}
- (void)applicationWillResignActive:(UIApplication *)application {
SKView* view = [self getSKViewSubview];
if (view) {
view.paused = YES;
}
}
- (void)applicationDidBecomeActive:(UIApplication *)application
{
SKView* view = [self getSKViewSubview];
if (view) {
view.paused = NO;
}
}