游戏锁屏之后打开自动退出

如标题求解,游戏锁屏了,第一次会正常,第二次就直接退出游戏了。

安卓机子? 打一下log看crash的原因。

游戏里面只要一锁屏,在打开游戏背景音乐消失是怎么回事?

在这里手动进行控制。

// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {
    Director::getInstance()->stopAnimation();

    // if you use SimpleAudioEngine, it must be pause
    // SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground() {
    Director::getInstance()->startAnimation();

    // if you use SimpleAudioEngine, it must resume here
    // SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
}
```

void AppDelegate::applicationDidEnterBackground()
{
CCDirector::sharedDirector()->stopAnimation();

SimpleAudioEngine::sharedEngine()->pauseBackgroundMusic();
CCLOG("SimpleAudioEngine 000 pauseBackgroundMusic");

}

// this function will be called when the app is active again
void AppDelegate::applicationWillEnterForeground()
{
CCDirector::sharedDirector()->startAnimation();

SimpleAudioEngine::sharedEngine()->resumeBackgroundMusic();
CCLOG("SimpleAudioEngine 111 resumeBackgroundMusic");

}

我试了 但是不行,LOG都出,但是没作用
如果自动锁屏LOG出现一次,音乐也能正常播放
如果手动锁屏LOG出现3次,音乐不能播放

:2::2::2::2:

我测试了一下。是没有问题的,3.2版本。

你可以先抽出一个最小系统看下是否有问题,再进行排查。