SpriteKit Crashing On Entering Background with [Flurry startSession:FlurryAPPKey];

扶醉桌前 提交于 2019-12-11 13:38:06

问题


I have googled this, and I found many debates over this, what i understand is this problem is related to rendering of OpenGl of Spritekit, Some people were facing this problem when they were playing AUdio with Spritekit.

While My case is different i am facing this when i integerate Flurry publisher Api using the Function

In [Flurry startSession:FlurryAPPKey];

in APPDelegete File

Commenting out the above code removed the problem.

I think there are a couple of things that when you integerate with SpriteKit this Happens as i found on google, like AVAudioSession, etc,

I just wanted to know, what is the best practice to avoid such rendering problem, or this may really be happening with Flurry Sdk 4.4.2? don't know but the backtrace is showing

#0  0x3311b932 in gpus_ReturnNotPermittedKillClient ()
#24 0x31032844 in UIApplicationMain ()
#25 0x0004cd16 in main at ....

here is the link of sample code Flurry SpriteKit


回答1:


You should always pause your SKView upon backgrounding. This will prevent SpriteKit from generating the gpus_ReturnNotPermittedKillClient exception. It seems that some services which perform background work, such as Flurry & AVAudioSession, interfere with SpriteKit in this way. So to prevent this you can do the following.

// Register for relevant application lifecycle notifications
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(applicationWillResignActive)
                                             name:UIApplicationWillResignActiveNotification
                                           object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self
                                         selector:@selector(applicationDidBecomeActive)
                                             name:UIApplicationDidBecomeActiveNotification
                                           object:nil];

// Pause/Unpause SKView instance
- (void)applicationWillResignActive
{
    [[self skView] setPaused:YES];
}

- (void)applicationDidBecomeActive
{
    [[self skView] setPaused:NO];
}


来源:https://stackoverflow.com/questions/24321477/spritekit-crashing-on-entering-background-with-flurry-startsessionflurryappkey

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!