Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
Hi all.

Being a newbie, i am making use of iPhone simulator to test my apps.

I want to know what will be the state of my app, if an incoming call will occur?
whether the state get saved (by default) or can we write any code in our app to take care of the state of our app??

Please help as soon as possible..
Thanks.
 

wrldwzrd89

macrumors G5
Jun 6, 2003
12,110
77
Solon, OH
Hi all.

Being a newbie, i am making use of iPhone simulator to test my apps.

I want to know what will be the state of my app, if an incoming call will occur?
whether the state get saved (by default) or can we write any code in our app to take care of the state of our app??

Please help as soon as possible..
Thanks.
My understanding is that you need to take care of saving the state. For applications that take advantage of Objective-C's built-in serialization mechanism, this generally means you don't have to do any work at all, besides making sure your application isn't in a critical region (a place where interrupting would cause problems). For example, in a game, you'd want to put the game into a paused state if you detect an incoming call.
 

Buschmaster

macrumors 65816
Feb 12, 2006
1,306
27
Minnesota
I believe what you are looking for is
Code:
- (void)applicationWillTerminate:(UIApplication *)application;
What you will want to do is find a way to save a state. What I'm using is a property list to manage much of the data for my app. So I have another property list that acts as a cache and stores the last level of navigation it was on and a couple other things it needs. Right now I have it so that it should come back to right where you were, but I'm thinking of possibly making it so that if you exit on purpose it will restart the app.

Additionally, I'm not on forums quite often enough to keep up with all of the chat language. What's v/s?
 

Sbrocket

macrumors 65816
Jun 3, 2007
1,250
0
/dev/null
So here's the corollary to this - is there some way to tell if the application will be relaunched after whatever closed it is finished (I believe calls ending will relaunch the open app after they're finished, but I could be wrong, at which point this would all be moot) or if it wont?

In other words, the difference between a call closing the app and the user closing the app manually. Seems like there would be many cases where you'd want to save the state in one, but not the other (a calculator for example).
 

sujithkrishnan

macrumors 6502
Original poster
May 9, 2008
265
0
Bangalore
I believe what you are looking for is
Code:
- (void)applicationWillTerminate:(UIApplication *)application;
What you will want to do is find a way to save a state. What I'm using is a property list to manage much of the data for my app. So I have another property list that acts as a cache and stores the last level of navigation it was on and a couple other things it needs. Right now I have it so that it should come back to right where you were, but I'm thinking of possibly making it so that if you exit on purpose it will restart the app.

Additionally, I'm not on forums quite often enough to keep up with all of the chat language. What's v/s?


Hi,

I successfully made use of archiving of objects, but i ddnt get how to save the entire state of application !!
Also the above method get called if application terminate by user and by incoming call..
But i want to save state only when incoming call terminates the app.

Kindly give me a clear idea of how to save the state of app, and detect teh incoming call in the above method.

Is there any way to simulate incoming call in Iphone simulator?

Please help...:(
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.