How to programmatically prevent a Mac from going to sleep?

后端 未结 3 1989
轮回少年
轮回少年 2020-11-27 17:24

Is there way to prevent a Mac from going to sleep programmatically using Objective-C? The I/O kit fundamentals section on Apple\'s dev site tells me that a driver gets notif

3条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-27 18:08

    Just create an NSTimer that fires a function with this

    UpdateSystemActivity(OverallAct);
    

    I'm pretty sure that that's exactly what Caffeine does.

提交回复
热议问题