zoukankan      html  css  js  c++  java
  • 按Home键切换到后台后会触发libGPUSupportMercury.dylib: gpus_ReturnNotPermittedKillClient导致crash

    转自:http://www.eoeandroid.com/thread-251598-1-1.html

    好像有很多朋友都碰到过这个问题,即在真机调试时,按hone键返回桌面,再回到app时,app会crash或僵死。同时xcode停留在:
    libGPUSupportMercury.dylib`gpus_ReturnNotPermittedKillClient:
    0x372fa094: trap
    0x372fa096: nop

    原因在于AppDelegate.cpp里

    void AppDelegate::applicationDidEnterBackground()
    {
        CCDirector::sharedDirector()->pause();
    }
    
    void AppDelegate::applicationWillEnterForeground()
    {
        CCDirector::sharedDirector()->resume();
    }

    director在app切换至后台时若被pause,它其实并没有真正暂停,而是仍保持着每秒4帧的绘制速率。但在app处于后台时,ios是不允许app调opengl的。这个原因引发了上述问题。

    解决方法是:

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

    stopAnimation()才让director真正暂停下来。

    另:播放视频时按home键crash问题:
    http://blog.k-res.net/archives/1193.html
  • 相关阅读:
    消费RabbitMQ时的注意事项,如何禁止大量的消息涌到Consumer,保证线程安全
    消费RabbitMQ时的注意事项,如何禁止大量的消息涌到Consumer,保证线程安全
    scrollTop值为0等疑难杂症
    9.四平方和
    8.冰雹数
    7.搭积木
    6.凑算式
    5.分小组
    4.骰子游戏
    3.平方怪圈
  • 原文地址:https://www.cnblogs.com/Clin/p/3405173.html
Copyright © 2011-2022 走看看