I need to quit an application from another application. I know how to open another application from my application but I don’t know how to quit it.
To Open other app:
CFURLRef mtURL = CFURLCreateWithString(kCFAllocatorDefault,CFSTR("TestApplication:"), NULL);
LSOpenCFURLRef(mtURL,nil);
Can any one please suggest on this?
Thank you,
Chandra.
Are you launching that app or is it already running?
If you are launching it yourself, instead of using your URL method, you could use a NSTask, that would give you more control on the exectution.
NSTask has a terminate message you can send.
See this page for some examples: http://www.cocoadev.com/index.pl?NSTask
Also see this SO question: How to terminate a process (not self) from inside a Cocoa application