Search code examples
iphonebuttonbackgroundhome-button

Send app to background and show the app(s) in the below window


I dont want my app to run in background, I only want to give the user the option to close his/her other app(s) when my app gets a memory warning. That is, my app shows an alert view with Cancel and OK buttons. If s/he touches OK, then the twice push on the home button is simulated. Is it possible?

I have this as an option in their settings, i.e. if they want to see the memory warning or not. I mentioned that I don't want my app running in background, because I see many questions asked here about running their own app in background. It is not relevant to my question, I just wanted to make it clear.


Solution

  • This is not possible.

    When your app receives a memory warning it should act responsibly and free memory where it can. From the Apple docs

    When a view controller receives a memory warning (didReceiveMemoryWarning), it should relinquish ownership of resources that are currently not needed and that can be recreated later if required.

    I'm not quite sure what this has to do with not running your app in the background.