MFMailComposeViewController附件文件大小限制 [英] MFMailComposeViewController attachment file size limit
问题描述
我正在使用MFMailComposeViewController
发送文件. 15mb以下的文件一切正常.一切都结束了,并且该文件根本没有附加到MFMailComposeViewController
视图.并不是电子邮件服务器不接受邮件,而是它从未被附加.
I'm using MFMailComposeViewController
to send a file. Everything works fine with files under 15mb. Anything over, and the file simply doesn't get attached to the MFMailComposeViewController
view. It's not that the email server isn't accepting, its that it never gets attached in the first place.
是否有人可以解决这个问题?
Does anyone have any ideas if there's a way to resolve that?
我知道许多电子邮件服务无法处理超过5或10 mb的附件,但是其他服务允许您更大的文件大小.
I know many email services can't handle attachments over 5 or 10mb, but other services allow you much larger file size.
MFMailComposeViewController *mail = [[[MFMailComposeViewController alloc] init] autorelease];
mail.mailComposeDelegate = self;
NSString* path = [NSString stringWithFormat:@"%@/%@/%@", NSHomeDirectory(), @"Documents", fileName];
NSData *data = [NSData dataWithContentsOfMappedFile:path]; //also tried dataWithContentsOfFile with same results
[mail addAttachmentData:data mimeType:@"audio/x-caf" fileName:[NSString stringWithFormat:@"%@.caf", label]];
[appDelegate.tabBarController presentModalViewController:mail animated:YES];
推荐答案
在2009年前的iPhone或iPod上将15 MB的任何内容加载到RAM中,将真正突破流程可用的极限内存,因此没有上限也就不足为奇了.我不会试图说服组合视图接受更大的附件.相反,我建议您将文件传输到某个外部服务器,然后通过电子邮件发送链接或从那里发送邮件.
Loading a 15 MB anything into RAM on a pre-2009 iPhone or iPod is going to really push the limits of your process's available memory, so it's not surprising there's a cap. I wouldn't try to convince the compose view to accept a larger attachment; instead, I'd suggest you transfer the file to some external server and either e-mail a link to it or send the mail from there.
这篇关于MFMailComposeViewController附件文件大小限制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!