Man*_*nOx 2 xcode ios mfmailcomposeviewcontroller
我想使用带有.csv扩展名的NSString(已经制作)创建一个文件,然后使用UIMessage框架通过电子邮件发送它.那么有人可以告诉我创建文件的代码(带有.csv扩展名和NSString的内容)然后如何将它附加到MFMailComposeViewController.
mel*_*sam 12
这是将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.
Run Code Online (Sandbox Code Playgroud)
至于如何生成CSV文件本身,https://github.com/davedelong/CHCSVParser上的CHCSVWriter类 将为您提供帮助.
| 归档时间: |
|
| 查看次数: |
5611 次 |
| 最近记录: |