我在我的应用程序中实现了本地通知,但我只是想知道是否有一种方法可以播放不属于 NSMainbundle 的声音。基本上在我的应用程序中,我希望用户录制在生成本地通知时播放的声音播放预先录制的声音。我已读出 Apple 文档 但我还在应用商店上看到了 2 -3 个应用程序,它们的做法就像这个应用程序 应用程序的链接 我想知道如何正在播放自定义声音(不属于 NSMainBundel 的声音)
任何人都知道我该怎么做?
先感谢您
I implemented local notification in my app but I am just wondering is there a way to play a sound that is not part of the NSMainbundle.Basically in my app, I want user to record a sound that gets played when the local notification is generated instead of playing a pre-recorded sound. I have read out the Apple Documentation but i have also seen 2 -3 Apps on app store which is doing it like the this App link of the App i am wondering how the are playing custom sounds (sounds which are not the part of NSMainBundel)
Anyone has any idea how I can do it ?
Thank you in Advance
发布评论
评论(1)
您可以做的是利用
AVAudioRecorder
并将其录音保存到iPhone的文档目录中。录制完成后,您可以使用
AVAudioPlayer
通过录制文件的路径。华泰
What you can do is to utilize the
AVAudioRecorder
and save its recordings to the documents directory of the iPhone.After the recording is done, you can play the very same files using an
AVAudioPlayer
via the path of the recorded files.HTH