Friday, 15 August 2014

ios , Attach Audio file aac format to Email -



ios , Attach Audio file aac format to Email -

i seek send sound record file aac (kaudioformatmpeg4aac) format file attached it's doesn't send

*mystring = file://localhost/private/var/mobile.......

here code

mfmailcomposeviewcontroller *picker = [[mfmailcomposeviewcontroller alloc] init]; picker.mailcomposedelegate = self; [picker setsubject:@"my sound file"]; nsstring *filename = @"rec.aac"; nsstring *documentsdirectory = mystring ; nsstring *path = [documentsdirectory stringbyappendingpathcomponent:filename]; nsdata *data = [nsdata datawithcontentsoffile:path]; [picker addattachmentdata:data mimetype:@"audio/aac" filename:filename]; nsstring *emailbody = @"aac format sound file attached."; [picker setmessagebody:emailbody ishtml:yes]; [self presentmodalviewcontroller:picker animated:yes]; [picker release];

nsdata *data = [nsdata datawithcontentsoffile:path];

you're passing in file:// url, won't understood method. method expects standard file path, i.e. /private/var/mobile/.

you utilize file path, if you're provided url form string, can create url object , utilize nsdata.

nsurl* fileurl = [nsurl urlwithstring:mystring]; nserror* error = nil; nsdata* info = [nsdata datawithcontentsofurl:fileurl options:0 error:&error]; if (error) { nslog(@"unable load file provided url %@: %@", mystring, error); }

ios email avaudioplayer email-attachments mfmailcomposeviewcontroll

No comments:

Post a Comment