Get the soundName by soundID to assign it to a UIL

2019-03-03 07:57发布

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条回答
Deceive 欺骗
2楼-- · 2019-03-03 08:16

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.

查看更多
登录 后发表回答