无法在 iPhone 上发送带有视频/音频附件的电子邮件!
我正在尝试使用 MFMailComposeViewController 发送电子邮件。我可以发送附有图像的电子邮件,但当我尝试附加 mp3 或 mp4 文件时,我收到此消息:
DA|无法打开 /tmp/DAAccountsLoading.lock 处的锁定文件。无论如何,我们都会加载帐户,但可能会发生不好的事情
(如果似乎在我开始填写“收件人”字段后立即出现),并且发送消息失败。
这是我的代码(HelperUtils 类只是我创建的,我确信问题不存在):
NSData *myData = [NSData dataWithContentsOfFile:[HelperUtils getPathWithEnding:media.name]];
NSString *mimeTypeStr = [HelperUtils getMimeTypeOfFileWithPath:[HelperUtils getPathWithEnding:media.name]];
NSLog(mimeTypeStr);
NSLog([HelperUtils getPathWithEnding:media.name]);
[picker addAttachmentData:myData mimeType:mimeTypeStr fileName:media.name];
I am trying to send an email with MFMailComposeViewController. I'm able to send emails with images attached, but when I try to attach mp3 or mp4 files I get this message:
DA|Could not open the lock file at /tmp/DAAccountsLoading.lock. We'll load the accounts anyway, but bad things may happen
(if seems to appear right after I start filling the "To" field), and sending the message fails.
Here is my code (The HelperUtils class is just something I created and I'm sure the problem is not there):
NSData *myData = [NSData dataWithContentsOfFile:[HelperUtils getPathWithEnding:media.name]];
NSString *mimeTypeStr = [HelperUtils getMimeTypeOfFileWithPath:[HelperUtils getPathWithEnding:media.name]];
NSLog(mimeTypeStr);
NSLog([HelperUtils getPathWithEnding:media.name]);
[picker addAttachmentData:myData mimeType:mimeTypeStr fileName:media.name];
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
对我来说适用于 mp3 文件。当你说mp4失败时,以什么方式失败?
如果应用程序在几次后崩溃,则很可能在某个地方出现内存泄漏。
works for me with mp3 files. when you say it fails with mp4, in what way?
if app is crashing after a few, you have a memory leak somewhere most likely.