通过soundID获取soundName,将其分配给UILocalNotification

我有一个UILocalNotification ,我不想把它设置为使用默认的音色。 我已经使用AudioToolbox.framework,并通过引用这个库有一个SystemSoundID : https : //github.com/TUNER88/iOSSystemSoundsLibrary 。

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

UILocalNotification类中的soundName描述参考提及

对于此属性,请指定应用程序主包中声音资源的文件名(包括扩展名)或UILocalNotificationDefaultSoundName以请求默认系统声音。

所以,如果你想默认的本地通知声音使用UILocalNotificationDefaultSoundName

另外还有“ 多媒体编程指南”的说明

注意:系统提供的警报声音和系统提供的用户界面声音效果不适用于您的应用程序。

所以你不能使用你在iOSSystemSoundsLibrary中find的任何系统声音ID。

如果你想要一个自定义的声音,你必须提供自己的。