Get the soundName by soundID to assign it to a UILocalNotification

我的未来我决定 提交于 2019-12-20 05:39:30

问题


I have a UILocalNotification, and I don't want to set it to use a default tone. I have used AudioToolbox.framework, and I have a SystemSoundID by referring to this library: https://github.com/TUNER88/iOSSystemSoundsLibrary.

But UILocalNotification needs a sound name. How can I get the name from the SystemSoundID?


回答1:


Description of soundName in UILocalNotification Class Reference mentions

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.

So if you want the default local notification sound use UILocalNotificationDefaultSoundName.

Also, a note from Multimedia Programming Guide

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

So you cannot use any system sound id you find in iOSSystemSoundsLibrary for this.

If you want a custom sound, you'll have to provide your own.



来源:https://stackoverflow.com/questions/29722172/get-the-soundname-by-soundid-to-assign-it-to-a-uilocalnotification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!