I am trying to send an email from within my iOS app using MFMailComposeViewController.
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)
The application crashes on this line:
self.mailhelp!.mailComposeDelegate = self
with:
fatal error: unexpectedly found nil while unwrapping an Optional value
Trying to print anything from within the mailhelp object, shows nil.
What's odd is that the app was already in use for some time now and this was tested and was working just fine just about 1 month or so ago. When I fired the app today, it crashed. Tried on all iOS devices, same thing. And I don't recall updating those devices recently or making any other change that might cause any issues.
Any thoughts? Also, has anyone encountered any similar issues (an app that start crashing out of the blue)?