开发者

How to set sound from user ringtones in UILocalNotfication?

I want 10 ringtones, and as I am setting my UILocalNotification开发者_StackOverflow中文版, I want the particular ringtone should be rang? How can I do it?


You would need to add these ringtones as sound files to your project and then assign appropriate sound based on user selection. According to the documentation you can either specify the default sound using the constant or specify custom filename. No way to access iPhone's ringtones:

soundName The name of the file containing the sound to play when an alert is displayed.

@property(nonatomic, copy) NSString *soundName

Discussion

For this property, specify the filename (including extension) of a sound resource in the application’s main bundle or UILocalNotificationDefaultSoundName to request the default system sound. When the system displays an alert for a local notification or badges an application icon, it plays this sound. The default value is nil (no sound). Sounds that last longer than 30 seconds are not supported. If you specify a file with a sound that plays over 30 seconds, the default sound is played instead.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜