我又来了,有点麻烦。
我想从我的应用程序发送一封附有 pdf 的电子邮件,所以我执行了以下操作:
- (IBAction) sendMail:(UIButton *)sender {
MFMailComposeViewController *controller1 = [[MFMailComposeViewController alloc] init];
controller1.mailComposeDelegate = self;
if ([MFMailComposeViewController canSendMail]) {
[controller1 setSubject:@"Brochure"];
if (sender.tag == 101) {
NSString *filePath = [[NSBundle mainBundle] pathForResource: @"web link" ofType: @"pdf"];
NSData *pdfData = [NSData dataWithContentsOfURL:filePath options: error:
[controller1 setMessageBody:@"Brochure File" isHTML:YES];
[controller1 addAttachmentData:pdfData mimeType:@"application/pdf" fileName:@"brochure.pdf"];
}
[self presentModalViewController:controller1 animated:YES];
}
[controller1 release];
}
没有问题,没有错误,没有什么。当我尝试从我的 iPad 发送它时,有一个带有“附加”文件的小图标,但是当我收到电子邮件时,它是空的,没有附件,什么也没有。有什么我想念的吗?