Change push notification sound file, only works after iOS reboot

I have problem with an iOS app access a file in the

Library/Sounds
directory.

My iOS app delivers different sound files in the main app bundle. I have written some code which copies a selected file into the

Library/Sounds
directory. It always has the same name (
foo.caf
) in that directory.

This way I am able to switch to different push notification sounds. If I do this the first time everything works fine. But if I switch to an other app and I receive a push notification there is no sound anymore. Also the default sound isn't played. But the strange thing is, that if I reboot the iPhone and I receive a new push notification I get the newly selected sound..

Does iOS have some cache or something else, which I have to reset first? Or is this an iOS bug?


EDIT:

I have written a small demo project to reproduce the problem. It can be found at:

Source code: https://github.com/patricks/PushNotificationSoundSwitch/releases

Git Repo: https://github.com/patricks/PushNotificationSoundSwitch

Readme file: https://github.com/patricks/PushNotificationSoundSwitch/blob/master/README.md

Replies

I have updated this question and added a sample project to reproduce the problem.

@patrick, did you solve this or improve the reliability?