Search code examples
iosaudiopush-notificationbundleaddition

Swift add audio files to bundle when released


Recently I came across apple's developer limitations. As I read you can not use custom notification sounds that are outside your bundle.

soundName Property

For this property, specify the filename (including extension) of a sound resource in the app’s main bundle or UILocalNotificationDefaultSoundName to request the default system sound. When the system displays an alert for a local notification or badges an app icon, it plays this sound. The default value is nil (no sound). Sounds that last longer than 30 seconds are not supported. If you specify a file with a sound that plays over 30 seconds, the default sound is played instead.

But what we want to do is record some audio file and use that as notification sound. We already set the recording limit to 30 seconds so it can be used for notification sounds.

Is there anyway we can use this custom recorded sound as notification sound? (This is our key concept actually so if this doesn't work our idea fails haha)

I already browsed several topics but they were quiet old so I was hoping maybe someone found a way with the new swift or something.


Solution

  • Short answer : This is not possible.

    Due to the code signing concept – the whole bundle is signed to be protected against mutation – you can't add files at runtime to the main bundle of the application.