Mac开发_使系统进入休眠状态,即熄屏

- (void)system_Sleep_Now {
    NSTask *task = [[NSTask alloc] init];
    task.launchPath = @"/usr/bin/pmset";
    task.arguments = @[@"sleepnow"];
    [task launch];
}
posted @ 2023-08-29 00:49  CH520  阅读(27)  评论(0编辑  收藏  举报