【发布时间】:2015-05-18 08:53:56
【问题描述】:
我有一个 iOS 应用程序,它应该允许用户选择一个 pdf 文件并通过该电子邮件帐户发送,我有以下代码向用户显示电子邮件并显示附加的 pdf,但是发送电子邮件pdf 未附加到收到的电子邮件中。
-(void)displayComposerSheet
{
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
[picker setSubject:@"Public Holidays"];
NSString *plistFilePath = [[NSBundle mainBundle] pathForResource:currentCountry ofType:@"pdf"];
NSData *myData = [[NSFileManager defaultManager] contentsAtPath:plistFilePath];
[picker addAttachmentData:myData mimeType:@"application/pdf" fileName:currentCountry];
// Fill out the email body text
NSString *emailBody = @"Attached to this email is the PDF bought";
[picker setMessageBody:emailBody isHTML:NO];
[self presentModalViewController:picker animated:YES];
}
【问题讨论】:
-
是plist文件还是PDF文件?文件被找到还是为零?
标签: ios email pdf mfmailcomposeviewcontroller