English 中文(简体)
iPhone SDK:将流式音频文件保存到“文档”文件夹中
原标题:
  • 时间:2009-01-08 07:45:19
  •  标签:

我想在我的应用程序的“文档”文件夹中保存一个音频文件,而我的应用程序中的一个类正在流式传输它。我该如何做?

是否可能直接将流式音频保存为mp3格式?(如果正在流式传输的音频文件是mp3格式,还是必须使用caf格式?)

谢谢。

Edit: What if I am running the save in another thread and the user exits the application? I know an app cannot run in the background in an iPhone, but is there any way I can stop the download and remove the partially saved file when the user exits the app? Can I get an exit signal inside a class or in a delegate for NSURLConnection?

最佳回答

如果您正在使用NSURLConnection或CFNetwork下载文件,可以在connectionDidFinishLoading委托中保存它。

Take a look at Matt Gallaghers Streaming and playing an MP3 stream

问题回答
(void)applicationWillResignActive:(UIApplication *)application
{

}

请在Appdelegate文件的上述方法中编写您的代码。

If you want to clean up your partially saved file on exit,
you could do worse than doing it from

- (void)applicationWillTerminate:(UIApplication *)application -(void) applicationWillTerminate:(UIApplication *)application

在您的应用程序控制器中。





相关问题
热门标签