Optimization level breaks my app


I have an app that used to work, but I just tried to update it now it doesn't work in Relase builds (but it's fine in Debug builds). It turns out that when the Swift compiler optimization level is at "Fast, Whole Module Optimization" (the default for Release) my app fails to play sound with AVSpeechSynthesizer. Is this a bug is Swift? It should behave the same, correct? Or is there something I can look for in my code that might cause a change in behavior with the optimization level?



Perhaps if you talked a bit about which version Xcode/Swift etc. your app supports.