IOS消息推送聲音默認(rèn)使用系統(tǒng)聲音,可以支持自定義。
注意事項(xiàng):
1.由于系統(tǒng)播放器播放支持的音頻格式系統(tǒng)默認(rèn)三種aiff, wav, 和 caf (應(yīng)用在前端后臺(tái)不運(yùn)行都可以播放,只要安裝應(yīng)用能收到消息就可以)。
轉(zhuǎn)換方法(afconvert /System/Library/Sounds/Submarine.aiff ~/Desktop/sub.caf -d ima4 -f caff -v)。
2.音頻放在工程主目錄。
3.音頻時(shí)長(zhǎng)不要超過(guò)30s。
4.音頻名稱要和{"aps":{"alert":"This is some fancy sound message.","badge":2,"sound": "sound.caf"}}要和推送的sound字段值保持一個(gè)可以自己定義。
5.真機(jī)運(yùn)行,靜音模式聽(tīng)不到。關(guān)閉靜音模式。
詳見(jiàn)官網(wǎng):https://developer.apple.com/library/content/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/IPhoneOSClientImp.html#//apple_ref/doc/uid/TP40008194-CH103-SW1
