Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Example Analysis of attachments in email sent by iOS12 system Application

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly introduces the example analysis of attachments in the email sent by the application of the iOS12 system, which is very detailed and has a certain reference value. Interested friends must finish reading it!

Attachments in emails sent by iOS12 system applications

IOS12 system applies attachments in sending mail. If there are a lot of contents in the email, or contain documents, pictures, etc., it can be sent in the form of attachments. At this point, you need to use the addAttachmentData (_: mimeType:fileName:) method, which has the following syntax:

Func addAttachmentData (_ attachment: Data, mimeType: String, fileName filename: String)

The parameters are described as follows:

Attachment: the data to be attached.

MimeType: specifies the MIME type of the data, for example, the MIME type of JPEG image is image/jpeg. This parameter can be nil.

Filename: the preferred file name associated with the data. This name is the default name applied to the file when transferred to the destination.

[example 3-2] send an email with a picture attachment below. The code is as follows:

@ IBAction func addAttachment (_ sender: Any) {let composeVC = MFMailComposeViewController () composeVC.mailComposeDelegate = selfcomposeVC.setToRecipients (["address@example.com"]) / / add image attachments let addPic=UIImage (named: "image.jpg") let imageDataaddPicpictures .pngData () composeVC.addAttachmentData (imageDataframes, mimeType: ", fileName:" landscapePicture.jpg ") self.present (composeVC, animated: true, completion: nil)}

Running the program and tapping the button opens the standard email interface provided by MFMailComposeViewController, as shown in figure 3.2.

The above is all the contents of the article "sample Analysis of attachments in emails sent by iOS12 applications". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report