On iOS I do not receive anymore calls to applicationDidEnterBackground / applicationWillEnterForeground.
For that reason, the game is not pausing / resuming, creating big problems.
I’m using 3.17.2 and that’s quite strange because I developed an older game (always with 3.17.2) and I’m getting these calls correctly (applicationDidEnterBackground / applicationWillEnterForeground).
Any idea why?
I know it could be related to iOS13 and new UIScene management, but it doesnt work for me.
I’ve added additional notifications:
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillResignActive:) name:UISceneWillDeactivateNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidBecomeActive:) name:UISceneDidActivateNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appDidEnterBackground:) name:UISceneDidEnterBackgroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(appWillEnterForeground:) name:UISceneWillEnterForegroundNotification object:nil];
No luck … maybe I’m doing something wrong?
In any case, very strange my older 3.17.2 project still work …
I was searching a bit more and I found out that Google Admob generates the “problem”.
If I add “GoogleMobileAds.framework”, then I stop getting applicationDidEnterBackground() and applicationWillEnterForeground() on my AppController.mm file.
I’m using latest GoogleMobileAdsSdkiOS-7.58.0.
To answer your question, these functions on AppController.mm never get called anymore after adding Admob when pausing/resuming my game:
and thus, I cannot properly call:
cocos2d::Application::getInstance()->applicationDidEnterBackground();
cocos2d::Application::getInstance()->applicationWillEnterForeground();
I fixed by adding a SceneDelegate to manage UIScene on iOS13.
Hardest part was keep it compatible with iOS12 devices and older because it’s really hard to test them without a proper simulator.