screencapture:不能 运行 一次两个交互式屏幕捕获

screencapture: cannot run two interactive screen captures at a time

        let imgPath: String = "\(self.tmpDir)captureRegion.png"

    //let screencapturePath = NSBundle.mainBundle().pathForAuxiliaryExecutable("/usr/sbin/screencapture")! as String
    let task = NSTask()
    task.launchPath = "/usr/sbin/screencapture"
    task.arguments = ["-i", "-r", imgPath]
    task.launch()
    task.waitUntilExit()

执行以上代码时,输​​出显示"screencapture: cannot run two interactive screen captures at a time",ScreenCapture 不工作

关闭沙盒或添加 com.apple.security.temporary-exception.mach-register.global-name 作为键和 com.apple.screencapture.interactive 作为权利文件的值。