Mac OS X- How to catch Logoff / Restart / Shutdown notifications and do few things before app/process terminates (Backgroud apps / Commandline tool ).
With foreground apps , I can achieve the same by using this delegate .
- (NSApplicationTerminateReply)applicationShouldTerminateNSApplication *)sender
But I do not want my application to run in foreground (i.e) shouldn't be shown on DOCK and App switcher . So I gave NSUIElement to 1 .
But during Logoff / shutdown , it does not allow to complete the -applicationShouldTerminate part . It kills the process midway .
Can any one please tell me how to achieve this using an app / commandline tool ?!!!
(In short, I need a Mac application that runs in background but gets applicationShouldTerminate's behaviour )
Thanks in advance .
PS : I already have tried NSApplicationActivationPolicy , it does same as NSUIElement 1 .
Regards ,
Gokul
With foreground apps , I can achieve the same by using this delegate .
- (NSApplicationTerminateReply)applicationShouldTerminateNSApplication *)sender
But I do not want my application to run in foreground (i.e) shouldn't be shown on DOCK and App switcher . So I gave NSUIElement to 1 .
But during Logoff / shutdown , it does not allow to complete the -applicationShouldTerminate part . It kills the process midway .
Can any one please tell me how to achieve this using an app / commandline tool ?!!!
(In short, I need a Mac application that runs in background but gets applicationShouldTerminate's behaviour )
Thanks in advance .
PS : I already have tried NSApplicationActivationPolicy , it does same as NSUIElement 1 .
Regards ,
Gokul