0
今天我第一次创建了Cocoa Application
。我想创建一个简单的应用程序,它将从我的Mac
打开一个APP,如果该文件未找到,它将显示一个Link
在Label
下载该应用程序。这是我的代码,我正在努力。如何从Xcode项目(可可应用程序)从Mac打开一个应用程序
if let fileCheck = NSURL.fileURL(withPath: "/Applications/Mango.app") {
if NSWorkspace.shared().open(fileCheck as URL) {
print("url successfully opened")
}
} else {
self.downloadLink.insertText("Invalid Path")
}
NSURL.fileURL(withPath: “/Applications/Mango.app”)给我有条件的绑定必须可选,我不知道如何解决。 And I am struggling with how to show a link on my Label either.
任何善良的Dev请帮助。