使用void kill工作从ios 6上的其他应用程序中杀死应用程序 [英] kill application from other application on ios 6 using void kill dont work
问题描述
我使用(void)kill来关闭在后台运行的其他应用程序。
这是我的代码:
#import SBApplication.h
SBApplication * app;
app = [[objc_getClass(SBApplicationController)sharedInstance]
applicationWithDisplayIdentifier:@my killed program id];
if(app)
[app kill];
现在,当我在ios 6中尝试时,我无法让它工作!
需要帮助吗?
只是为了扩展Victors回答一下......你想得到pid来自应用程序,如果它大于0(一个有效的pid),用SIGTERM(Nicer,虽然它不能保证杀死它)或SIGKILL(强制终止)杀死它
SBApplicationController * appController = [objc_getClass(SBApplicationController)sharedInstance];
SBApplication * app = [appController applicationWithDisplayIdentifier:appId];
if(app.pid> 0)
kill(app.pid,SIGTERM);
关于终止信号的信息:
http://www.gnu.org/software/libc/manual/html_node/Termination-Signals.html
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?
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
这篇关于使用void kill工作从ios 6上的其他应用程序中杀死应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!