thread1:swift上的exc_bad_instruction

时间:2016-02-07 21:16:37

标签: ios swift exc-bad-instruction

我确实有错误Thread1:EXC_BAD_INSTRUCTION。一直在努力做到这一点。那里有乐于助人的人员吗?

导入UIKit 导入AVFoundation

class PlaySoundsViewController:UIViewController {

var filePathUrl: NSURL!
var audioPlayer: AVAudioPlayer?
var receivedAudio:RecordedAudio!

override func viewDidLoad() {
    super.viewDidLoad()
    // Do any additional setup after loading the view.


    audioPlayer = try! AVAudioPlayer(contentsOfURL: receivedAudio.filePathUrl)
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

@IBAction func playFastAudio(sender: UIButton) {
    audioPlayer!.stop()
    audioPlayer!.rate = 1.5
    audioPlayer!.currentTime = 0.0
    audioPlayer!.play()
}

@IBAction func playSlowAudio(sender: UIButton) {
    // play audio slow
    audioPlayer!.stop()
    audioPlayer!.rate = 0.5
    audioPlayer!.currentTime = 0.0
    audioPlayer!.play()


}
@IBAction func StopButtonSound(sender: UIButton) {
    audioPlayer!.stop()
}

}

0 个答案:

没有答案