![Kill Command for a jailbroken iPhone(iOS X) [duplicate]](https://www.xszz.org/skin/wt/rpic/t23.jpg)
Question:
<blockquote>
<strong>Possible Duplicate:</strong><br /><a href="https://stackoverflow.com/questions/8963640/kill-command-for-a-jailbroken-iphone" rel="nofollow">Kill Command for a jailbroken iPhone</a>
</blockquote>Hey I am looking for a kill command that lets my app kill other apps while my app is running in the background. I am building my app on a jailbroken iPhone so I am looking for one that will work with the iOS X platform. Any help you can give me would be greatly appreciated. Thank You, rytime
Answer1:There is killall
, which will kill an application by it's binary's name, or there is kill
which will kill by a process ID. Are either of those what you want?
Example usage:
NSString *exec = [NSString stringWithFormat:@"killall %@", executableName];
system([exec UTF8String]);
<hr />NSString *exec = [NSString stringWithFormat:@"kill %i", processId];
system([exec UTF8String]);
Answer2:If your app isn't made especially for that purpose then you shouldn't do this without the user knowing it. You can either use "killall executableName"
in a system()
command or if you are developing for MobileSubstrate then you could hook some SpringBoard classes and close the SBApplication/remove the SBApplicationIcon from the switcher which will also close the corresponding SBApplication.