iPhone:将图像选择器中的图像附加到电子邮件不会显示在windows上

iPhone:将图像选择器中的图像附加到电子邮件不会显示在windows上,iphone,image,email,Iphone,Image,Email,[解决]我想我应该有RTFM!使用[MFMailComposeViewController addAttachmentData:mimeType:fileName:]完全解决了我的问题。根本不需要base64编码:) 对于任何感兴趣的人,都可以提供一些关于base64编码的好信息 我允许用户拍摄或选择图像并将其附加到电子邮件中。这封电子邮件在Mac Mail中发送和传递得非常好,但在Windows(Outlook Express和gmail)上,图像无法显示。Gmail告诉我“转换无法加载”

[解决]我想我应该有RTFM!使用[MFMailComposeViewController addAttachmentData:mimeType:fileName:]完全解决了我的问题。根本不需要base64编码:)

对于任何感兴趣的人,都可以提供一些关于base64编码的好信息

我允许用户拍摄或选择图像并将其附加到电子邮件中。这封电子邮件在Mac Mail中发送和传递得非常好,但在Windows(Outlook Express和gmail)上,图像无法显示。Gmail告诉我“转换无法加载”

下面是我用来将图像附加到电子邮件的代码。这一定与图像的编码有关。有人能提供建议吗

非常感谢你的帮助

- (void) createEmail {

// set up the image data.
NSData *imageData = [NSData dataWithData:UIImageJPEGRepresentation(self.imageToUpload, 1.0)];
NSString *base64String = [imageData base64EncodedString];
NSString *emailBodyString = [NSString stringWithFormat:@"<html><body><img src='data:image/jpeg;base64,%@'></body></html>",base64String];

// create the email modal
NSArray *recipients = [[NSArray alloc] initWithObjects:@"test@email.com",nil];

MFMailComposeViewController *emailDialog = [[MFMailComposeViewController alloc] init];
emailDialog.mailComposeDelegate = self;
[emailDialog setToRecipients:recipients];
[emailDialog setSubject:@"Time Sheet Submission from iPhone App"];
[emailDialog setMessageBody:emailBodyString isHTML:YES];

[self presentModalViewController:emailDialog animated:YES];
[emailDialog release];
[recipients release];
-(无效)创建电子邮件{
//设置图像数据。
NSData*imageData=[NSData-dataWithData:uiimagejpegresentation(self.imageToUpload,1.0)];
NSString*base64String=[imageData base64EncodedString];
NSString*emailBodyString=[NSString stringWithFormat:@',base64String];
//创建电子邮件模式
NSArray*recipients=[[NSArray alloc]initWithObjects:@”test@email.com“,无];
MFMailComposeViewController*emailDialog=[[MFMailComposeViewController alloc]init];
emailDialog.mailComposeDelegate=self;
[emailDialog setToRecipients:recipients];
[emailDialog设置主题:@“从iPhone应用提交时间表”];
[emailDialog setMessageBody:emailBodyString isHTML:YES];
[self-presentModalViewController:emailDialog动画:是];
[emailDialog发布];
[收件人释放];

}我想我应该有RTFM!使用[MFMailComposeViewController addAttachmentData:mimeType:fileName:]完全解决了我的问题。根本不需要base64编码:)


对于任何感兴趣的人,都可以提供一些关于base64编码的好信息。

我想我应该使用RTFM!使用[MFMailComposeViewController addAttachmentData:mimeType:fileName:]完全解决了我的问题。根本不需要base64编码:)


如果有人对base64编码感兴趣,请提供一些很好的信息。

刚刚发现我必须等待两天才能接受我的答案,我会回来然后再做。感谢泰坦尼克号。我刚刚发现我要等两天才能接受我的答案,到时候我会回来做的。谢谢TianiumDecoy