Programmatically check state of do not disturb on OS X

前端 未结 4 1116
悲&欢浪女
悲&欢浪女 2021-02-04 11:35

Using Objective-C, how can I programmatically check the state of the system \"Do Not Disturb\" setting on OS X? I\'m fine with using hacks or private APIs since I don\'t need to

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-04 12:05

    Swift 4

    UserDefaults(suiteName: "com.apple.notificationcenterui")?.bool(forKey: "doNotDisturb")
    

提交回复
热议问题