问题
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