swift pdf file not attaching to an email
<p>I have the below code which is suppose to attach a file named "file.pdf" which was created and placed into the temp directory as such </p>

<pre><code>pdfFileUrl = "\(NSTemporaryDirectory())file.pdf" 
</code></pre>

<p>But the email does not have my attachment as I am expecting it to</p>

<pre><code>@IBAction func sendEmail(sender: AnyObject) {

    createReportPDF()

    if MFMailComposeViewController.canSendMail() {
        let mail = MFMailComposeViewController()
        mail.mailComposeDelegate = self
        mail.setToRecipients(["dpreston10@gmail.com"])
        mail.setMessageBody("&lt;p&gt;You're so awesome!&lt;/p&gt;", isHTML: true)
        if let filePath = NSBundle.mainBundle().pathForResource(pdfFileUrl, ofType: "pdf") {
            print("File path loaded.")

            if let fileData = NSData(contentsOfFile: filePath) {
                print("File data loaded.")
                mail.addAttachmentData(fileData, mimeType: "application/pdf", fileName: "file.pdf")
            }
        }

        presentViewController(mail, animated: true, completion: nil)
    } else {
        // show failure alert
    }
}
</code></pre>