I am trying to play audio from a URL in my app. Everything happens as expected in iOS 8 (simulator and physical devices). For iOS 9, it works in simulator but on device, the aud
For anyone with this same issue, here is the Swift solution.
try! AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback, with: [])
And some documentation
After doing various trial and error tactics for over 5 days, I finally figured out that my problem was with the mute switch of the phone. When it is on mute, the audio does't play! So, I added the following line of code to specify my category as playback and now it plays even when my device switch is on mute
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
Thank you!