Why only the first 5 seconds of playing UNNotificationSound

After upgrading to iOS 10.1.1, custom iOS Notification sound stops after 5 seconds.

This only happens if the device is turned on, but when the device is turned off, it plays for as long as 30 seconds.

The UNNotificationSound documentation says:

You can pack the audio data into aiff, wav or caf file. Sound files should be less than 30 seconds long. If the sound file is longer than 30 seconds, the system plays the default sound.

https://developer.apple.com/reference/usernotifications/unnotificationsound

So, if we can install 30 second sound files, then there should be a way to allow them to play for 30 seconds, not only 5?

+9
source share
1 answer

By default, notifications last no more than 5 seconds when the device is unlocked . You cannot change this behavior programmatically. But the user can change the notification settings for the application, so the banners will not be hidden after 5 seconds. She needs to set the banner style to permanent . This problem was successfully solved in Periodic Timer + app.

+2
source

Source: https://habr.com/ru/post/1259999/


All Articles