Custom local notification sound duration

Hi,


On OS 10.0.2 with Xcode 8.0 and the custom sound does not play when I push a notification with the new UserNotifications framework which is a bug on that iOS version. But now after updating to iOS 10.1.1 the custom sound stop after 5 seconds.


The

UNNotificationSound
documentation says: "You can package the audio data in an
aiff
,
wav
, or
caf
file. Sound files must be less than 30 seconds in length. If the sound file is longer than 30 seconds, the system plays the default sound instead." https://developer.apple.com/reference/usernotifications/unnotificationsound


So if we're able to set 30 second sound files, then there must be a way of allowing them to play for 30 seconds not only 5?

Replies

Hi!


Same thing here! Xcode 8.2, IOS 10.2.


I have a meditation like sound, of about 27 seconds, that must be entirelly played.


If the phone is locked, the sound plays correctly, full lenght. When the phone is unlocked, and the app is inactive or in background, the sound plays as long as the Banner is show, beign suddenly cut when the Banner retracts. In the previous behavior, the sound was fully played, even after the Banner disappeared.


Just tested here that manually configuring, in phone Settings, from Banners to Alerts, it only gets out of the screen when the user swipes it up, and the sound keeps playing until that. I'll look for some way to programmatically set this option when creating the Notification.


Hope it helps!