6
私を助けてください!私は画像を送信することができますが、私は電子メールにアイコンファイルの添付ファイルが表示されますが、PDFファイルを送信することはできません。 マイコード:電子メールでpdfファイルを送信できないxcode
MFMailComposeViewController *sendmailview = [[MFMailComposeViewController alloc] init];
sendmailview.mailComposeDelegate = self;
// I can send image with:
// UIImage *roboPic = [UIImage imageNamed:@"Default.png"];
// NSData *imageData = UIImageJPEGRepresentation(roboPic, 1);
// [sendmailview addAttachmentData:imageData mimeType:@"image/png" fileName:@"Default.png"];
// But Can't send pdf file
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *file = [documentsDirectory stringByAppendingFormat:@"book.pdf"];
NSMutableData *data=[NSMutableData dataWithContentsOfFile:file];
[sendmailview addAttachmentData:data mimeType:@"application/pdf" fileName:@"book.pdf"];
// I see icon book.pdf when attach,but when i sent mail,mail receiver not see pdf file...
[self presentModalViewController:sendmailview animated:YES];
[sendmailview release];
........
おかげで私を助けて!
ありがとうございました!私はした:NSString * file = [documentsDirectory stringByAppendingFormat:@ "/ book.pdf"]; 今すぐ使える!ご協力いただきありがとうございます – user1002290