Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / how can I know when use close my game in iPad?

Author
Message
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 28th Oct 2011 18:57
using debug mode, I set a breakpoint in the app:End() , I close the game in iPad, then my game can't run through the breakpoint. why?

then how can I know the game is being exit? I need release the source and save the state of the game.

give my best
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 30th Oct 2011 08:01 Edited at: 30th Oct 2011 13:35
When an iPad ends the program uses

- (void)applicationWillTerminate: (UIApplication *)application

I think you could write some code here to advise you when application really exits, and realize saving data, etc (not for background mode)

To save the states of your game if it goes to background state and don't want to lose data you can use:

applicatonDidEnterBackground

You can find this functions in AppDelegate.m

May be it will be useful for you.
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 30th Oct 2011 15:28
thank you very much .but I am not familiar with object-c now.

give my best
JavierTF
14
Years of Service
User Offline
Joined: 15th Feb 2010
Location: Going out, to the right
Posted: 30th Oct 2011 17:15
You're welcome
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 7th Nov 2011 15:43
I test applicationWillTerminate, actually , it doesn't work. and app.end(). also doesn't work.

Then I don't know when I should release all the resource.

give my best
LeeBamber
TGC Lead Developer
24
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 11th Nov 2011 23:53
AGK releases all the resources automatically as it is a managed system. As was suggested higher up, if you want to capture the moment the iOS app ends, you will need to dive into Objective C to add a function call in which you can store any data you need to hold on to. You have highlighted an important feature not present in the universal T1 command set which is the question of what to do when the user prematurely terminates the app and you want to keep hold of all that last minute data. Traditionally you would have your data live on a cloud server so instant termination of the app client would not cause data to be lost, but where local data is concerned I can see the need. The problem is how to introduce an 'event' or 'callback' in what is a traditional sequential BASIC language?

I drink tea, and in my spare time I write software.
halley
12
Years of Service
User Offline
Joined: 27th Apr 2011
Location: China
Posted: 12th Nov 2011 04:06
I'm using Tier2 . C++

Basically ,I still don't know how to know when the game quit.

give my best

Login to post a reply

Server time is: 2024-03-29 07:50:39
Your offset time is: 2024-03-29 07:50:39