开发者

Mail the recorded audio

In my app i am recording audio. I want to mail the recorded audio file. I am doing like this.

MFMailComposeViewController *controller = [[MFMailComposeViewControlleralloc] init]; controller.mailComposeDelegate =self ;

NSData *myData = [NSData dataWithContentsOfURL:url];

Here url is the path.

printf("\n mydata %d",[myData length]);

When i am printing the data length i am able to get the length.

[controller addAttachmentData:myData mimeType:@"audio/caf" fileName:@"name"];

[self presentModalViewController:controller animated:YES];

After doing this file is attaching but when i am downloading it in my machine(Mac or windows) i am not able to play.

can any one pleas开发者_如何学运维e help me out.

Thank You


I had the exact same problem and finally bypassed it by just adding the file extension to the filename like so:

[controller addAttachmentData:myData mimeType:@"audio/caf" fileName:@"name.caf"];
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜