ios - thread1: exc_bad_instruction on swift -
i have error thread1: exc_bad_instruction. been trying hard on this. helpful personnel out there?
import uikit import avfoundation
class playsoundsviewcontroller: uiviewcontroller {
var filepathurl: nsurl! var audioplayer: avaudioplayer? var receivedaudio:recordedaudio! override func viewdidload() { super.viewdidload() // additional setup after loading view. audioplayer = try! avaudioplayer(contentsofurl: receivedaudio.filepathurl) } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can 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() }
}
Comments
Post a Comment