我正在尝试使用MFMailComposeViewController在我的iOS应用中发送电子邮件。
var mailhelp: MailComposerHelper? = nil
self.mailhelp = MailComposerHelper(fileName: self.currentObject.name as String, fileToSend: self.currentObject.lpath as String,sName: self.sName! as String)
self.mailhelp!.mailComposeDelegate = self
self.presentViewController(self.mailhelp!, animated: true, completion: nil)
应用程序在此行崩溃:
self.mailhelp!.mailComposeDelegate = self
with:
fatal error: unexpectedly found nil while unwrapping an Optional value
尝试从mailhelp对象中打印任何内容,显示为nil。
奇怪的是,该应用程序已经使用了一段时间了,这已经过测试,大约在1个月左右之前工作得很好。当我今天解雇应用程序时,它崩溃了。尝试在所有iOS设备上,同样的事情。我不记得最近更新这些设备或进行任何可能导致任何问题的其他更改。
有什么想法?此外,有没有人遇到任何类似的问题(一个开始崩溃的应用程序)?