我在我的 macOS Swift 应用程序中使用 NSSharingService有没有办法确保默认邮件客户端配置了有效的帐户?

问题描述

我正在使用 NSSharingService 为我的 macOS 应用程序的用户准备一封带有附件的电子邮件。我的代码是:

let emailService = nssharingservice.init(named: nssharingservice.Name.composeEmail)

if emailService.canPerform(withItems: [emailBody,zipFileURL]) {
   // email can be sent
   dispatchQueue.main.async {
       emailService.perform(withItems: [emailBody,zipFileURL])
   }
} else {
      // email cannot be sent
      // Show alert with email address and instructions
      self.showErrorAlert(with: 2803)
}

这可以正常工作,但如果代码在新系统上执行,Apple Mail 将被打开,要求用户配置电子邮件帐户。有些用户可能不明白在这种情况下发生了什么。有没有办法确定是否配置了认电子邮件客户端,以便我可以通知用户如果没有?感谢您的帮助。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)