Is it possible to 开发者_StackOverflow社区programmatically close all running applications on the iPhone except my own from within my own application? If so, how?
No. All apps run in a sandbox so that you can't communicate between them. And even if you technically could it would be considered bad practice.
Why do you need to close other apps? I can't think of any valid use case where that would be necessary.
An app doesn't have access to the home button on a stock device. The only other access to any other apps in the background is if they have registered a URL handler.
It's not possible and there's also no need to.
There are very conservative limits on how much processing a background app can use and if the result of low memory warnings is that there still isn't enough memory, the OS will automatically start killing things. Don't try to be clever - it's just as willing to kill you and indeed will kill you first if nothing else is running.
精彩评论