带有 UIActivityViewController 的 HTML 电子邮件正文 [英] HTML email message body with UIActivityViewController

查看:46
本文介绍了带有 UIActivityViewController 的 HTML 电子邮件正文的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果不继承 UIActivity,是否可以使用 UIActivityViewController (UIActivityTypeMessage) 通过邮件应用共享 html 消息?

Without subclassing UIActivity, is it possible to use UIActivityViewController (UIActivityTypeMessage) to share a html message via the Mail app?

当我将 HTML 作为 NSString 传递时,正文会在邮件正文中显示 html 标记(例如 ),这不是我想要的.

When I passed the HTML as NSString, the body shows the html tags (e.g. ) in the message body which is not what I want.

推荐答案

确保您传递给活动的字符串包含 .UIKit 的内部 UIMailActivity 类显式检查 的存在,以确定消息是 HTML 还是纯文本.

Make sure the string you pass into the activity includes <html. UIKit's internal UIMailActivity class explicitly checks for the presence of <html to determine if the message is HTML or plain text.

[r12 rangeOfString:@"<html" options:NSCaseInsensitiveSearch range:0x0];

请注意,虽然 UIActivity 被记录为可以发送 HTML 消息,但这种确切的触发机制并不是 API 合同的一部分.从技术上讲,它可能会在未来的版本中崩溃.

Note that while UIActivity is documented that it can send HTML messages, this exact trigger mechanism isn't part of the API contract. Technically, it could break in future versions.

这篇关于带有 UIActivityViewController 的 HTML 电子邮件正文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆