I get an error every time I try to run stating
fatal error: unexpectedly found nil while unwrapping an Optional value (lldb).
Could someone explain why? heres the code
import UIKit
import AVFoundation
class ViewController: UIViewController {
var player: AVAudioPlayer = AVAudioPlayer()
override func viewDidLoad() {
super.viewDidLoad()
let audioPath = NSBundle.mainBundle().pathForResource("Belly - Might Not", ofType: "mp3")!
do {
try player = AVAudioPlayer(contentsOfURL: NSURL(fileURLWithPath: audioPath))
player.play()
} catch {
// Process error here
}
}
}