gpt4 book ai didi

ios - 使用 MFMailComposer 发送电子邮件 CSV 文件

转载 作者:塔克拉玛干 更新时间:2023-11-02 08:50:51 24 4
gpt4 key购买 nike

我想使用带有 .csv 扩展名的 NSString(已经制作)创建一个文件,然后使用 UIMessage 框架通过电子邮件发送它。那么有人可以告诉我创建文件的代码(具有 .csv 扩展名和 NSString 的内容)然后如何将它附加到 MFMailComposeViewController。

最佳答案

这是将 CSV 文件附加到 MFMailComposeViewController 的方式:

    MFMailComposeViewController *mailer = [[MFMailComposeViewController alloc] init];
mailer.mailComposeDelegate = self;
[mailer setSubject:@"CSV File"];
[mailer addAttachmentData:[NSData dataWithContentsOfFile:@"PathToFile.csv"]
mimeType:@"text/csv"
fileName:@"FileName.csv"];
[self presentModalViewController:mailer animated:YES];

// Note: PathToFile.csv is the actual path of the file on your iOS device's
// file system. FileName.csv is what it should be displayed as in the email.

至于如何生成 CSV 文件本身,CHCSVWriter 类在 https://github.com/davedelong/CHCSVParser会帮助你。

关于ios - 使用 MFMailComposer 发送电子邮件 CSV 文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10677004/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com