objective c - Force quit OS X app -
which best way force quit os x or daemon process if know app/daemon name (the name appears in activity monitor)?
i using objective c coding.
you may use applescript that:
//tell application quit nsapplescript* restartapp = [[nsapplescript alloc] initwithsource:@"tell application \"applicationname\" quit"]; [restartapp executeandreturnerror:nil];
if app not responding may try
// define command nsstring* appname = @"finder"; nsstring* killcommand = [@"/usr/bin/killall " stringbyappendingstring:appname]; // execute shell command nstask *task = [[nstask alloc] init]; [task setlaunchpath:@"/bin/bash"]; [task setarguments:@[ @"-c", killcommand]]; [task launch];
which kills app.
good luck
Comments
Post a Comment