我设置了一个按钮,当按下该按钮时,应该更改它的图标并使麦克风静音,但是出现此错误,应用崩溃。
Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1eb5bbb2c)
代码如下:
@IBAction func btnMuteMicPressed(_ sender: Any) {
publisher.publishAudio = !publisher.publishAudio
let buttonImage: UIImage = {
if !publisher.publishAudio {
return #imageLiteral(resourceName: "group3-1")
} else {
return #imageLiteral(resourceName: "group3")
}
}()
btnMuteMic.setImage(buttonImage, for: .normal)
}
它在第一次返回时崩溃。为什么?