Where to write release code before app close?

Where to write release code before app close?
0

#1

Where to write release code before app close?


#2

Depending on what you’re trying to achieve you can write your ‘release’ code in

  • your class destructor
  • CCNode/CCSprite::onExit()
  • CCScene::onExit()
  • in AppDelegate::applicationDidEnterBackground() (but I guess this is not what you want)
    Note that there’s no ‘exit’ or ‘close’ application event (iOS does not allow you to exit your app).
    On Android though, you might enable the keypad (setKeypadEnabled(true)) and call CCDirector::sharedDirector()->end() when the back key is hit. The onExit method still will be called on your objects.

#3

:slight_smile: thanks.