Use Swift to call a mailer in the app and
I wanted to automatically enter the destination email address and subject line when I called, so I organized the following programs:
// Generate mailer URL.
let myMailURL:NSURL = NSURL (string: "mailto:[email protected]")!
let myMailSub:NSURL=NSURL(string: "Subject=\(dateString)"!
UIAApplication.sharedApplication().openURL(myMailURL)//mail address
UIAApplication.sharedApplication().openURL(myMailSub)// Subject
There are no errors in simulators or debugs, but
If you check it on the actual machine, it will fall off as soon as you call the mailer.
In my estimation, I thought the subject was wrong, and I thought the subject was strange.
If you don't mind, please let me know.
Thank you for your cooperation.
The second URL is not a mailto: scheme, so the mailer will not start.Put them all together
NSURL (string: "mailto:[email protected]?subject=(dateString)")
must be .Also, if dateString
contains slashes that are not available in the URL,
varescapedDateString=dateString.stringByAddingPercentEncodingWithAllowedCharacters (.URLHostAllowedCharacterSet())
You should escape with
However, do you mean that you would like to send an email with the address, title, and attachment?openURL:
does not support attachments, and UIDocumentInteractionController
can only specify that the file should be opened in another app, so MFMailComposeViewController is a good idea.
601 GDB gets version error when attempting to debug with the Presense SDK (IDE)
611 Uncaught (inpromise) Error on Electron: An object could not be cloned
573 Understanding How to Configure Google API Key
577 PHP ssh2_scp_send fails to send files as intended
894 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
© 2024 OneMinuteCode. All rights reserved.