I need to be able to implement methods:
On Mac, I use Xcode, but I canโt understand the code to complete these steps.
Can anyone help me here?
thanks
A trivial / lazy way to do this through some simple built-in Applescript:
NSString *scriptAction = @"restart"; // @"restart"/@"shut down"/@"sleep"/@"log out" NSString *scriptSource = [NSString stringWithFormat:@"tell application \"Finder\" to %@", scriptAction]; NSAppleScript *appleScript = [[NSAppleScript alloc] initWithSource:scriptSource]; NSDictionary *errDict = nil; if (![appleScript executeAndReturnError:&errDict]) { NSLog(@"%@", errDict); }