我想通过电子邮件发送.mov文件。因此,我正在使用MFMailComposeViewController。在花费一些时间搜索后,我最终写出了以下代码。
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *myPathDocs = [documentsDirectory stringByAppendingPathComponent:
[NSString stringWithFormat:@"/Saved Video/%@",[player.contentURL lastPathComponent]]];
MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
mail.mailComposeDelegate = self;
[mail addAttachmentData:[NSData dataWithContentsOfURL:[NSURL URLWithString:myPathDocs]] mimeType:@"video/quicktime" fileName:[myPathDocs lastPathComponent]];
[mail setSubject:@"Share VIDEO by My App"];
[self presentViewController:mail animated:YES completion:nil];
当邮件编辑器出现时,我可以在邮件正文中看到附件,但是我收到的邮件没有附件。我错过了什么吗?还是做错了什么?
请帮助我。