Suppose i am running my iphone/ipad application my mistake i pressed home key and again i am running my application it started as usual to i don开发者_JAVA技巧't want to it started as usual i want to it start from the state where i was before pressing home key.
**In short it should be maintain the state of application while i am running next time.
in the function - (void)applicationDidEnterBackground:(UIApplication *)application
inside your application delegate .m file, be sure that you don't call the exit
function. when the home button is pressed, anything in this function will be ran.
- (void)applicationDidEnterBackground:(UIApplication *)application {
//do nothing
}
This behaviour is default as of iphone 4.1 and ipad 4.2. YOu actually have to specifically stop it if you didn't want it. What version are you building for?
If it is the latest build, then like what binnnyb said, ahve a look in applicationDidEnterBackground
and applicationWillResignActive
for functions that will crash or end your app.
Also exit();
is not app store safe.
Implement - (void)applicationWillResignActive:
in your NSApplicationDelegate
to save your application state. You can then reload the saved state at startup.
精彩评论