gpt4 book ai didi

ios - 通过 soundID 获取 soundName 以将其分配给 UILocalNotification

转载 作者:行者123 更新时间:2023-11-28 19:50:00 25 4
gpt4 key购买 nike

我有一个 UILocalNotification,我不想将它设置为使用默认提示音。我使用了 AudioToolbox.framework,并且通过引用此库获得了 SystemSoundID:https://github.com/TUNER88/iOSSystemSoundsLibrary .

但是UILocalNotification 需要一个声音名称。如何从 SystemSoundID 获取名称?

最佳答案

soundName in UILocalNotification Class Reference 的描述提及

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

因此,如果您想要默认的本地通知声音,请使用 UILocalNotificationDefaultSoundName

此外,来自 Multimedia Programming Guide 的注释

Note: System-supplied alert sounds and system-supplied user-interface sound effects are not available to your application.

因此您不能使用在iOSSystemSoundsLibrary 中找到的任何 系统声音ID为此。

如果您想要自定义声音,则必须提供自己的声音。

关于ios - 通过 soundID 获取 soundName 以将其分配给 UILocalNotification,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29722172/

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