我有一个 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/35784633/