Hi, I am trying to incoporate audio into an app that I'm making and I use the simulator to test but the second it gets on it goes back to the project screen with a line highlighted and a thread error below it saying
Thread 1:EXC_BAD_INSTRUCTION(code=EXC_I386_INVOP,subcode=0x0)
and another error in the debug area saying
fatal error: unexpectedly found nil while unwrapping an Optional value (lldb)
The code i am using is this
/
ViewController.swift
***********************
Created by Marco Simonelli on 26/04/2015.
Copyright (c) 2015 Antonio Enterprises. All rights reserved.
*/
import UIKit
import AVFoundation
class ViewController: UIViewController {
var ButtonAudioURL = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("TURDY BIRD BACKGROUND T1 copy", ofType: "wav")!)
var ButtonAudioPlayer = AVAudioPlayer()
override func viewDidLoad() {
super.viewDidLoad()
/
ButtonAudioPlayer = AVAudioPlayer(contentsOfURL: ButtonAudioURL, error: nil)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
/
}
@IBAction func PlayButton1(sender: AnyObject) {
}
}
line 20 is where i get the thread error.
please help me.
Thanks in advance.
🙂🙂🙂
P.S.
i am not sure if i was meant to add in a library or emmbedded binarys in it beause i have not.