I'm working on an app for iPhone that uses a webview and lots of deeplinks because I'm lazy. I've configured the deeplink listening part of the app and that works great, but that method doesn't seem to be able to play systemsound or AVAudio. It doesn't error, it just doesn't play. I have this written in the method:
var iSaySound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("isay", ofType: "mp3")!)
var youSaySound = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("yousay", ofType: "mp3")!)
var iSayPlayer = AVAudioPlayer(contentsOfURL: iSaySound, error: nil)
iSayPlayer.prepareToPlay()
iSayPlayer.play()
These sounds play in another part of the app fine, but not here. Does it have to do with it being in the AppDelegate? What's going on? Remember this is Swift
It is possible that the object is released before it ended playing the sound. Please check my similar question here : Swift - AVAudioPlayer, sound doesn't play correctly
Where I've created a singleton as it was suggested.
Let me know if it helped.