【发布时间】:2019-10-03 00:34:04
【问题描述】:
在NSWorkspace.shared.open() 中的其他一些Stack Overflow code examples 之后,我想出了这个:
@IBAction func mailFileVacuum(_ sender: NSButton) {
let receiver = sender.alternateTitle
let sendAddress = String(format: "mailto:%@@filevacuum.com?subject=FileVacuum %@", receiver, receiver).addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
NSLog("receiver %@", receiver)
let mailUrl = URL(string: sendAddress)
NSLog("mailUrl %@", mailUrl!.absoluteString)
if NSWorkspace.shared.open(mailUrl!) {
print("Default browser was successfully opened to send email. ????????")
}
}
☝️这让我们明白了????
我尝试更改默认浏览器,这不是问题。
NSLog(mailUrl) 记录此mailto%3AFeedback%40filevacuum.com%3Fsubject=FileVacuum%20Feedback
看起来不错吧????...
¿Que Paso?
【问题讨论】:
-
@LeoDabus,这只是一个例子。他们都在该示例链接中使用
UIApplication.shared().openURL(url)。我正在使用来自developer.apple.com/documentation/appkit/nsworkspace的NSWorkspace.shared.open(url)