本文介绍了未收到从iOS应用程序/MFMailComposeViewController发送的附件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用MFMailComposeViewController
从应用程序内发送附件(pdf).但是,当我在设备上对此进行测试时,我没有收到附件.知道可能是什么问题吗?
I am using MFMailComposeViewController
to send attachments (pdfs) from within the app. However I am not receiving the attachments when I test this on a device. Any idea what can be the problem?
- (void) emailDocument
{
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
NSData *data = [[NSData alloc] initWithContentsOfURL:pdfURL];
mailController.mailComposeDelegate = self;
[mailController setSubject:[self title]];
[mailController setMessageBody:@"Please find the attached documents." isHTML:YES];
[mailController addAttachmentData:data mimeType:@"application/pdf" fileName:@"document"];
[self presentModalViewController:mailController animated:YES];
}
推荐答案
尝试理解此代码,对您有帮助.
try to understand this code,it helps u.
- (void)viewDidLoad
{
if ([MFMailComposeViewController canSendMail])
myButton.enabled = YES;
}
- (IBAction)buttonPressed
{
MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
mailController.mailComposeDelegate = self;
[mailController setSubject:@"Hello iPhone"];
[mailController setMessageBody:@"This is the MailSend Application...." isHTML:NO];
[self presentModalViewController:mailController animated:YES];
[mailController release];
}
- (void)mailComposeController:(MFMailComposeViewController*)mailController didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error
{
[self becomeFirstResponder];
[self dismissModalViewControllerAnimated:YES];
}
谢谢
这篇关于未收到从iOS应用程序/MFMailComposeViewController发送的附件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!