kill application from other application on ios 6 u

2019-02-26 07:36发布

i got jailbreak iphone ios 6

in my tweak on ios 4&5 I used (void) kill to close other app running in the background. this is my code:

#import "SBApplication.h"

SBApplication *app ;
app = [[objc_getClass("SBApplicationController") sharedInstance]
           applicationWithDisplayIdentifier:@"my killed program id "];
if(app)
    [app kill];

now when i trying that in ios 6 i cant get this to work ! need help?

3条回答
在下西门庆
2楼-- · 2019-02-26 07:39

How about good old "kill(pid, signal);"?

If you have appropriate (root?) privileges, it should work for you.

查看更多
Ridiculous、
3楼-- · 2019-02-26 07:51

Just to expand on Victors answer a bit... you want to get the pid from the application and if it is greater than 0(a valid pid), kill it with either SIGTERM(Nicer, though it's not guaranteed to kill it) or SIGKILL(Forceful Termination)

SBApplicationController *appController = [objc_getClass("SBApplicationController") sharedInstance];
SBApplication *app = [appController applicationWithDisplayIdentifier:appId];
if (app.pid > 0)
    kill(app.pid, SIGTERM);

Info About Termination Signals: http://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html

查看更多
我命由我不由天
4楼-- · 2019-02-26 07:52

Assuming the second app is yours, you could open the second app with openURL and have it kill itself in the App Delegate callback.

查看更多
登录 后发表回答