2016-10-21 25 views
1
 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() 

,它顯示:在輸出「抓屏不能運行兩個交互式屏幕捕獲在一個時間」,和抓屏不工作抓屏:不能運行兩個交互式屏幕捕捉在上面的代碼是在執行時間

回答

1

打開關閉沙盒或添加com.apple.security.temporary-exception.mach-register.global-name作爲密鑰,並將com.apple.screencapture.interactive作爲授權文件的值。