Parse Push Notification with custom sound plays default sound

前端 未结 2 1406
粉色の甜心
粉色の甜心 2021-01-27 12:37

I send a parse push notification which the app receives, but the sound requested does not play, instead the default sound plays. The sounds have been saved by the app in the doc

相关标签:
2条回答
  • 2021-01-27 13:15

    According to the documentation here, mp3 isn't a supported file type. Are you sure you were getting this mp3 file to play before? If so, you were experiencing undocumented/unsupported behavior.

    Here's the pertinent bit:

    Preparing Custom Alert Sounds

    For remote notifications in iOS, you can specify a custom sound that iOS plays when it presents a local or remote notification for an app. The sound files must be in the main bundle of the client app.

    Custom alert sounds are played by the iOS system-sound facility, so they must be in one of the following audio data formats:

    Linear PCM
    MA4 (IMA/ADPCM)
    µLaw
    aLaw

    You can package the audio data in an aiff, wav, or caf file. Then, in Xcode, add the sound file to your project as a nonlocalized resource of the app bundle.

    You may 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

    You can inspect a sound to determine its data format by opening it in QuickTime Player and choosing Show Movie Inspector from the Movie menu.

    Custom sounds must be under 30 seconds when played. If a custom sound is over that limit, the default system sound is played instead.

    0 讨论(0)
  • 2021-01-27 13:22

    It is possible that the audio format that you use is not supported. Was it a different file when it was working ? Check with the apple documentation.

    0 讨论(0)
提交回复
热议问题