Reputation: 1295
When the iphone home button is pressed, it will only hide the user interface but any process currently running will keep on running at the background. I find that if the process is still running, when i activate the app again, the splash screen will be displayed for a long time until the process is completes before it display the main page of the app. Is there a way to terminate the processes when the home button is pressed?
1) For example, if I have a for loop and before the loop finishes, the home button is pressed, is there a way to terminate the loop?
2) What if instead of a loop, its a delegate waiting for the sdk function to finish the process. eg. After calling UIImageWriteToSavedPhotosAlbum to save an image, didFinishSavingWithError will be called when it finish saving. Can i terminate the saving process whe the home button is pressed?
Thanks.
Upvotes: 0
Views: 1426
Reputation: 233
Not to do 1, but add the following method to the app delegate
and do something in the method like exit(0)
Upvotes: 2
Reputation: 2992
You can try adding a new row in the info.plist of your application and select "Application does not run in background" or write "UIApplicationExitsOnSuspend"
Upvotes: 6