2

我一直在尝试使用 MFMailComposer 发送一个包含加密数据的文本文件。问题是当电子邮件到达收件箱时,我的附件永远不会出现。<br/><br/>相反,总是存在一行“ ”。我假设这与 mime 类型有关,并且接收者邮件服务器不知道如何读取数据,但我只是想不出一个解决方案。

有人遇到过这个并有解决方案吗?

if([MFMailComposeViewController canSendMail]) {
   MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];
   mailController.mailComposeDelegate =self;
   [mailController setSubject:@"Records"];
   [mailController setMessageBody:@"" isHTML:YES];
   [mailController addAttachmentData:dataToBeEncrypted mimeType:@"text/plain" fileName:@"Records.txt"];
   [self presentModalViewController:mailController animated:YES];
   [mailController release];
  } else {
  //Pop up a notification
   UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Could not send email. Verify Internet conneciton and try again." delegate:nil cancelButtonTitle:@"Done" otherButtonTitles:nil];
   [alert show];
   [alert release];
  }

谢谢你提供的所有帮助!

4

1 回答 1

1

想我得到了解决。在看到另一个例子后,我只是在黑暗中拍了一张照片,它似乎奏效了。对于 mimetype,我只输入了 @"mime"。

我有点厌倦了,所以我必须做更多的测试来确保文件总是正确的。

于 2010-07-25T15:36:26.870 回答