Disable sleep mode in OS X with swift

后端 未结 2 718
南笙
南笙 2021-01-05 15:08

I made an OS X Application in Xcode and I want to keep my Mac from going to sleep when I have it open. I know in iOS Swift you use:

UIApplication.sharedAppli         


        
2条回答
  •  囚心锁ツ
    2021-01-05 15:35

    If you are trying to prevent idle triggered sleep, IOCancelPowerCharge might work. But it won't work if something manually triggers the sleep

提交回复
热议问题