0
我的PDF文件作爲附件出現在UIWebView和iphone上的郵件屏幕上。當我將它發送到我的電子郵件(使用兩個不同的電子郵件運營商)時,它會被刪除 - 沒有文件附件。我可以發送PDF到這些電子郵件帳戶在我的iPhone和轉發他們好,所以我不認爲它是我的電子郵件提供商,但iOS是剝離文件?我可以附加圖片確定但不是PDF文件。不知道問題出在哪裏,以及如何找到問題發生的地方。謝謝!PDF文件從iPhone剝離MFMailComposeViewController調用
我的代碼:
-(void)doSendEmail :(NSString *)use_email :(NSString *)amsg {
if ([MFMailComposeViewController canSendMail]) {
MFMailComposeViewController* controller = [[MFMailComposeViewController alloc] init];
controller.mailComposeDelegate = self;
[controller setToRecipients:[NSArray arrayWithObjects:use_email, nil]];
NSString *filen=self.filepath1;
NSString *pdfPath = [[NSBundle mainBundle] pathForResource:filen ofType:@"pdf"];
NSData *pdfData = [NSData dataWithContentsOfFile:pdfPath];
[controller addAttachmentData:pdfData mimeType:@"application/pdf" fileName:self.filename1]
}
//Set messages
[controller setSubject:self.subject];
[controller setMessageBody:amsg isHTML:NO];
//Display email for user to send
[self presentModalViewController:controller animated:YES];
[controller release];
}
-(void)mailComposeController:(MFMailComposeViewController*)controller
didFinishWithResult:(MFMailComposeResult)result
error:(NSError*)error {
if ((result == MFMailComposeResultSent) && (stat==4)) {
billsent=1;
}
[self dismissModalViewControllerAnimated:YES];
}