最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】iOS中程序崩溃:ViewController onFYRtcEngine CallEnd unrecognized selector sent to instance

iOS crifan 2967浏览 0评论

折腾:

【已解决】用飞语FYRtcEngineKit去实现基本的iOS间的语音通话

期间,点击 挂断按钮:

结果程序就崩溃了:

FYRtcEngineKitDemo[787:145041] -[FYRtcEngineKitDemo.ViewController onFYRtcEngine:CallEnd:]: unrecognized selector sent to instance 0x17624150
2017-10-19 17:48:56.783020+0800 FYRtcEngineKitDemo[787:145041] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[FYRtcEngineKitDemo.ViewController onFYRtcEngine:CallEnd:]: unrecognized selector sent to instance 0x17624150’
*** First throw call stack:
(0x1babfb3d 0x1ad47067 0x1bac4fd1 0x1bac2f63 0x1b9ebdc8 0xbfaa7 0x1ba6bdb9 0x1ba6b6f9 0x1ba6b4e1 0x1bac6309 0x1b9cf0f5 0x1c31c0ed 0xb1103 0xb6a2d 0x1dd8f3 0x1b7127 0x1bba4f 0x9d224 0x9df00 0x20d263b5 0x20d26349 0x20d10979 0x20d25c85 0x20d257cf 0x20d2070f 0x20cf22bb 0x214857f7 0x2148019b 0x2148057d 0x1ba7bfdd 0x1ba7bb05 0x1ba79f51 0x1b9cd1af 0x1b9ccfd1 0x1d177b41 0x20d55a53 0xa3394 0x1b1ba4eb)
libc++abi.dylib: terminating with uncaught exception of type NSException

相关代码:

    @IBAction func endCallBtnEvent(_ sender: UIButton) {
        //        fyRtcEngine.leaveChannel(nil)
        if (isCalling) {
            fyRtcEngine.endCall(self.endCallCallback)
            self.infoNotice(“挂断通话”)
        } else {
            let dialOption:FYOptionData = FYOptionData()
            dialOption.isRecord = true
            //dialOption.maxDuration = 60 * 60 * 24
            dialOption.maxDuration = 60 * 10
            let otherUid = self.otherTextField.text!
            let selfUid = self.selfTextField.text!
            fyRtcEngine.dialPeer(otherUid, callerUid: selfUid, optionData: dialOption)
            self.infoNotice(“主叫:调用dialPeer”)
        }
        self.isCalling = !self.isCalling
        self.updateCallButtonImage()
    }

但是第一次点击是没有问题的。

通话后,再点击挂断,结果就崩溃了。

unrecognized selector sent to instance

小萝莉说Crash(一):Unrecognized selector sent to instance xxxx – DEV CLUB

【iOS】unrecognized selector sent to instance出现的原因和解决方案 – Elite, not coder – ITeye博客

unrecognized selector sent to instance问题之诱敌深入关门打狗解决办法 – Wonderffee’s Blog

unrecognized selector sent to instance报错总结 – 简书

iOS中的unrecognized selector sent to instance.. – 简书

IBAction unrecognized selector sent to instance

iphone – IBAction Button “Unrecognized Selector Sent to Instance” Error – Stack Overflow

xcode – IBAction for UIButton Causes an unrecognized selector sent to instance error (iOS) – Stack Overflow

ios – iPhone: IBAction Causes “Unrecognized Selector Sent to Instance” Error – Stack Overflow

objective c – iOS—Button causing unrecognized selector sent to instance 0x7f803a59cc50 – Stack Overflow

ios – @IBAction crashes app in Swift – Stack Overflow

试试:

//    @IBAction func endCallBtnEvent(_ sender: UIButton) {

    func endCallBtnEvent(sender: UIButton) {

结果第一次点击就会出错

【总结】

后来继续调试发现:

FYRtcEngineKitDemo[806:149759] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[FYRtcEngineKitDemo.ViewController onFYRtcEngine:CallEnd:]: unrecognized selector sent to instance 0x15573fc0’
*** First throw call stack:

错误信息中,是CallEnd函数中,找不到对应的实例而报错

而此处实际上,是没有添加对应的飞语SDK的代理FYRtcEngineKitDelegate的CallEnd

而去加上对应的CallEnd函数:

    func onFYRtcEngine(_ engine: FYRtcEngineKit!, callEnd status: FYRtcEngineStatus!) {
        self.infoNotice(“通话结束: \(statusToShortStr(fyStatus: status))”)
    }

即可解决此问题。

转载请注明:在路上 » 【已解决】iOS中程序崩溃:ViewController onFYRtcEngine CallEnd unrecognized selector sent to instance

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
90 queries in 0.206 seconds, using 22.13MB memory