Very noob questions on Mac OS X programming. I want to make a very simple sample application for Mac OS X. Tasks:

1. When enabled, the application sends a command to the terminal. Previously, I did nothing under the desktop, but I understand that in my case I go to AppDelegate.m and write:

<code>-(void)awakeFromNib: { //код для вызова unix-команды }</code> 

Interested in the syntax of such code, and in this method to do it or in - applicationDidFinishLaunching: :?

2. After executing this command, the app should immediately close. In the same method to prescribe - applicationWillTerminate ?

Thanks in advance for the answers.

    1 answer 1

    system("ваша команда системе"); it is from si and works great in obs

    • The system works as planned, thank you very much! And how to send a terminate application? - AlexThumb
    • one
      If you know its PID, then kill () system call (see man 2 kill) - avp
    • Probably I didn't exactly put it. It is required that the application closes itself. Apparently the construction of the type [self applicationWillTerminate]; but I don’t know what exactly, now I’m rummaging in terminate methods - AlexThumb
    • 2
      Just exit (0) will not work? - avp
    • 2
      @AlexThumb, call [[NSApplication sharedApplication] terminate: nil]; in the place where you need to terminate the application. - VioLet