【发布时间】:2016-06-02 20:23:47
【问题描述】:
我正在寻找一种使用 Swift 通过我的应用程序禁用睡眠模式和屏幕保护程序的方法。我知道 question 有 been 询问过 before,但没有一个答案是当前(至少对于 Swift 而言;我不了解 Objective-C)。
本来想用NSWorkspace.sharedWorkspace().extendPowerOffBy(requested: Int),但是根据Apple's documentation,目前没有实现。
有什么建议吗?
【问题讨论】:
-
您是否碰巧找到了解决方案?对于 UIApplication,可以这样做:
UIApplication.shared.isIdleTimerDisabled = true,但isIdleTimerDisabled不是NSApplication的成员。如果您找到解决方案,我会很高兴。 -
@Andreas 不幸的是,我没有。