0
在這裏我再次,有一些麻煩。郵寄附加PDF從代碼
我想從我的附有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發送它時,有一個帶有「附加」文件的小圖標,但是當我收到電子郵件時,它是空的,沒有附件,沒有任何內容。有什麼我失蹤?