MacOS开发笔记-打开隐私权限

2020-07-29  本文已影响0人  voyager3

示例代码如下:

        self.view.window?.level = .normal
        let success = LocalSecurity().getTrust()
        if success {
            NSWorkspace.shared.openFile("/System/Library/PreferencePanes/Security.prefPane")
        }else{
            AXIsProcessTrustedWithOptions(
            [kAXTrustedCheckOptionPrompt.takeUnretainedValue() as String: true] as CFDictionary)
        }
上一篇 下一篇

猜你喜欢

热点阅读