邮寄录制的音频
在我的应用程序中,我正在录制音频。我想邮寄录制的音频文件。我正在这样做。
MFMailComposeViewController *控制器 = [[MFMailComposeViewControlleralloc] init]; 控制器.mailComposeDelegate = self ;
NSData *myData = [NSData dataWithContentsOfURL:url];
这里url是路径。
printf("\n mydata %d",[myData 长度]);
当我打印数据长度时,我可以获得长度。
[controller addAttachmentData:myData mimeType:@"audio/caf" fileName:@"name"];
[selfpresentModalViewController:controlleranimated:YES];
完成此操作后,文件已附加,但当我将其下载到我的机器(Mac 或 Windows)中时,我无法播放。
谁能帮帮我吗?
谢谢
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 please help me out.
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了完全相同的问题,最后通过将文件扩展名添加到文件名中来绕过它,如下所示:
I had the exact same problem and finally bypassed it by just adding the file extension to the filename like so: