我正在使用 Xcode 和 swift 3 为我开发一个项目。我想做的是如下。
class SCViewController: UIViewController, AVCaptureMetadataOutputObjectsDelegate{
//code here
}
Run Code Online (Sandbox Code Playgroud)
但这给了我一个错误SCViewController不符合协议NSObjectProtocol。
我想同时遵守 UIViewController 和 AVCaptureMetadataOutputObjectsDelegate。请帮助我解决这个问题。
我编写了一个 C# 程序,它使用命令行参数来打开和关闭防火墙。
Process proc = new Process();
string top = "netsh.exe";
proc.StartInfo.Arguments = "**Advfirewall set allprofiles state on**";
proc.StartInfo.FileName = top;
proc.StartInfo.UseShellExecute = false;
proc.StartInfo.RedirectStandardOutput = true;
proc.StartInfo.CreateNoWindow = true;
proc.Start();
proc.WaitForExit();
// MessageBox.Show("Disable");
button1.Text = "Set On";
status = false;
Run Code Online (Sandbox Code Playgroud)
我还以管理员权限运行该应用程序。该应用程序会自动以管理员权限运行,但不会将防火墙状态设置为打开或关闭。
当我在 cmd(netsh) 中运行相同的命令时,防火墙会打开或关闭。
有谁知道为什么这不起作用?