必现!iOS 13系统, v1.9.3的example切换到后台再切回前台,游戏不响应

  • Creator 版本:1,9.3

  • 目标平台: iOS 13 不确定12会不会有

  • 详细报错信息,包含调用堆栈:

  • 重现方式:打包官方example即可, 切到后台再切回来不响应,所有都无法点击,除了restart按钮

  • 之前哪个版本是正常的 :我换了1.6, 1.10.x(具体多少忘了)都有一样的问题,最后换成v2.2.1没问题了

  • 手机型号 :iPhone7 Plus

  • 编辑器之前是否有其它报错 :

  • 出现概率:必现

官方能否告知针对这个问题,V2.2.1是怎么修复的?尝试升级了引擎,改动量太大了, 大量API被废弃,JS又是解释型脚本,错误都得在运行时才能体现,风险太大,改了一天放弃了。

所以想知道官方是怎么解决的,能不能在v.1.x的基础上解决?

这个问题卡了我3天了, 希望官方大佬能抽空看下, 不胜感激

暂时用Xcode 10 编译试试,不过这样不用用ios13的真机调试了

问题已经解决了
注释掉AppController.mm

- (void)applicationWillEnterForeground:(UIApplication *)application {
    /*
      Called as part of  transition from the background to the inactive state: here you can undo many of the changes made on entering the background.
    */
    auto glview = (__bridge CCEAGLView*)(Director::getInstance()->getOpenGLView()->getEAGLView());
    auto currentView = [[[[UIApplication sharedApplication] keyWindow] subviews] lastObject];
    if (glview == currentView) {
        cocos2d::Application::getInstance()->applicationWillEnterForeground();
    }
}

把这个if判定注释掉就好了, iOS 13这个if判定过不去
快哭了, 看了我们项目早期的 Cocos2d-js的代码,也是没有这个判定的,然后cocos creator v2.2.1也是没有

另外 creator注释掉了这个代码,不知道有没有什么影响,暂时也不敢开起来

- (void)applicationWillResignActive:(UIApplication *)application {
    /*
      Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
      Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    */
    // We don't need to call this method any more. It will interrupt user defined game pause&resume logic
    /* cocos2d::Director::getInstance()->pause(); */
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
    /*
      Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    */
    // We don't need to call this method any more. It will interrupt user defined game pause&resume logic
    /* cocos2d::Director::getInstance()->resume(); */
}

多谢回复,我后面试下你说的方法,目前是通过注释掉 进入前台的判定, 无脑调进入前台的代码

这个判断确实有问题,比如在登陆界面点微信登陆授权再回来 两个view就不一样了:joy:

有没有遇到切后台时间久 再切回前台 游戏崩的