【发布时间】:2015-07-29 18:48:36
【问题描述】:
我正在开发一个简单的应用程序作为初学者项目,它应该发送带有 HTML 正文的邮件。 我需要将 HTML 文件转换为字符串。 然后我可以把它作为邮件的 html 正文。谢谢
var url_k_html = NSURL(fileURLWithPath:NSBundle.mainBundle().pathForResource("main", ofType:"html")!)
更新:为了清楚起见,我还在这里写 solution,因为它在答案的评论中:
var url = NSURL(fileURLWithPath:NSBundle.mainBundle().pathForResource("file", ofType:"html")!)!
var string = String(contentsOfURL: url, encoding: NSUTF8StringEncoding, error: nil)!
【问题讨论】:
标签: html string swift mfmailcomposeviewcontroller