views:

1333

answers:

3

Hi guys,

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];
A: 
NSString *mp3File = [NSTemporaryDirectory() stringByAppendingPathComponent: @"tmp.mp3"];
NSURL    *fileURL = [[NSURL alloc] initFileURLWithPath:mp3File];
NSData *soundFile = [[NSData alloc] initWithContentsOfURL:fileURL];
[mailDialogController addAttachmentData:soundFile mimeType:@"audio/mpeg" fileName:@"tmp.mp3"];

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.

bpink
A: 

Did you ever figure this out. My mp4 files aren't sending either.

Johnny