Android 当尝试在Xcode中运行adb命令时,我收到;“不允许操作”;
我正在编写一个在Xcode中运行adb命令的程序,但是在运行该命令时,我收到了错误消息“zsh:1:operation not allowed:adb”。我已经将scheme环境变量PATH设置为adb文件夹,启用了对Xcode的完全磁盘访问,并禁用了SIP。有没有想过为什么会出现这个消息Android 当尝试在Xcode中运行adb命令时,我收到;“不允许操作”;,android,xcode,macos,adb,Android,Xcode,Macos,Adb,我正在编写一个在Xcode中运行adb命令的程序,但是在运行该命令时,我收到了错误消息“zsh:1:operation not allowed:adb”。我已经将scheme环境变量PATH设置为adb文件夹,启用了对Xcode的完全磁盘访问,并禁用了SIP。有没有想过为什么会出现这个消息 func shell(_ command: String) -> String { let task = Process() let pipe = Pipe()
func shell(_ command: String) -> String {
let task = Process()
let pipe = Pipe()
task.standardOutput = pipe
task.launchPath = "/bin/zsh"
task.arguments = ["-c", command]
task.launch()
let data = pipe.fileHandleForReading.readDataToEndOfFile()
let output = String(data: data, encoding: .utf8)!
return output
}
@IBAction func pull(_ sender: Any) {
print(shell("echo $PATH"))
print(shell("adb version"))
}
当我在正常终端窗口中使用工作adb键入echo$PATH时,我得到以下信息供参考:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/lam/adb
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin:/Users/lam/adb