美文网首页
iOS 替换通知声音

iOS 替换通知声音

作者: RobinZhao | 来源:发表于2017-07-04 16:33 被阅读0次

    Preparing Custom Alert Sounds

    Local and remote notifications can specify custom alert sounds to be played when the notification is delivered. You can package the audio data in an aiff, wav, or caf file. Because they are played by the system-sound facility, custom sounds must be in one of the following audio data formats:

    • Linear PCM
    • MA4 (IMA/ADPCM)
    • µLaw
    • aLaw

    Place custom sound files in your app bundle or in the Library/Sounds folder of your app’s container directory. Custom sounds must be under 30 seconds when played. If a custom sound is over that limit, the default system sound is played instead.
    You can use the afconvert tool to convert sounds. For example, to convert the 16-bit linear PCM system sound Submarine.aiff to IMA4 audio in a CAF file, use the following command in the Terminal app:

    afconvert /System/Library/Sounds/Submarine.aiff ~/Desktop/sub.caf -d ima4 -f caff -v
    

    For information on how to associate a sound file with a notification, see Adding a Sound to the Notification Content.

    以上来自官方文档
    声音素材地址Online-Audio-Converter

    相关文章

      网友评论

          本文标题:iOS 替换通知声音

          本文链接:https://www.haomeiwen.com/subject/ymdxhxtx.html