0
在我的NSApplication中,我有一個按鈕。當我點擊它時,我想啓動/啓動一個守護進程/代理。我該如何繼續?我已經嘗試過:如何從NSApplication運行launchd agent /守護進程?
- (void) runAgent {
NSTask *task = [[NSTask alloc] init];
task.launchPath = @"launchctl load /System/Library/LaunchAgents/com.mycompany.myagent.plist";
[task setLaunchPath:@"/bin/sh"];
[task launch];
}
沒有成功...