gpt4 book ai didi

ios - 如何使用本地通知播放录制的声音?

转载 作者:行者123 更新时间:2023-11-28 18:14:30 25 4
gpt4 key购买 nike

我有一个应用程序要求用户录制他们自己的消息以便在将来某个时间回放。我的意图是使用 UILocalNotification 来做到这一点。不幸的是,与本地通知关联的声音似乎必须存储在主包中,但用户无法进行录音并将其保存在包中。

如何让用户录制的声音文件通过本地通知播放?

或者 - 如果应用程序未运行,是否有办法捕获本地通知(无需等待用户响应警报)然后播放所需的声音文件?

谢谢!

最佳答案

您可以通过如下设置属性将(自定义)声音分配给 UILocalNotification:

localNotification.soundName = @"MySoundFile.wav";

不幸的是,根据引用资料,无法使用未存储在主包中或由 apple 声明的声音文件:

For this property, specify the filename (including extension) of a sound resource in the application’s main bundle or UILocalNotificationDefaultSoundName to request the default system sound.

另见 UILocalNotification Class Reference #soundName

关于ios - 如何使用本地通知播放录制的声音?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6514423/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com