在 WebRTC 库中关闭视图控制器时出现 EXC_BAD_ACCESS 错误时崩溃

Posted

技术标签:

【中文标题】在 WebRTC 库中关闭视图控制器时出现 EXC_BAD_ACCESS 错误时崩溃【英文标题】:crash on EXC_BAD_ACCESS error on dismiss view controller in WebRTC library 【发布时间】:2017-12-05 09:27:06 【问题描述】:

我在我的应用程序中使用 webRTC 框架进行音频通话。关闭调用视图控制器后,我在 App 委托上收到以下错误。

线程 1:EXC_BAD_ACCESS(代码=EXC_I386_GPFLT)

以下是xcode的截图

下面是堆栈跟踪

CallViewController.__ivar_destroyer:
0x101d2c780 <+0>:    pushq  %rbp
0x101d2c781 <+1>:    movq   %rsp, %rbp
0x101d2c784 <+4>:    subq   $0x20, %rsp
0x101d2c788 <+8>:    movq   %rdi, %rax
0x101d2c78b <+11>:   movq   %rax, -0x8(%rbp)
0x101d2c78f <+15>:   movq   0x16dfb02(%rip), %rax     ; direct field offset for GopChat.CallViewController.(ws in _024208FCD932FF59905765BE8E3FA1C3) : SwiftWebSocket.WebSocket
0x101d2c796 <+22>:   movq   (%rdi,%rax), %rax
0x101d2c79a <+26>:   movq   %rdi, -0x10(%rbp)
0x101d2c79e <+30>:   movq   %rax, %rdi
0x101d2c7a1 <+33>:   movq   %rsi, -0x18(%rbp)
0x101d2c7a5 <+37>:   callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c7aa <+42>:   movq   0x16defcf(%rip), %rax     ; direct field offset for GopChat.CallViewController.reachability : __ObjC.Reachability
0x101d2c7b1 <+49>:   movq   -0x10(%rbp), %rsi
0x101d2c7b5 <+53>:   movq   (%rsi,%rax), %rdi
0x101d2c7b9 <+57>:   callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c7be <+62>:   movq   0x16defc3(%rip), %rax     ; direct field offset for GopChat.CallViewController.btnBack : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIButton>
0x101d2c7c5 <+69>:   movq   -0x10(%rbp), %rsi
0x101d2c7c9 <+73>:   movq   (%rsi,%rax), %rdi
0x101d2c7cd <+77>:   callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c7d2 <+82>:   movq   0x16defb7(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblTopicWait : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2c7d9 <+89>:   movq   -0x10(%rbp), %rsi
0x101d2c7dd <+93>:   movq   (%rsi,%rax), %rdi
0x101d2c7e1 <+97>:   callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c7e6 <+102>:  movq   0x16defab(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblMessageWait : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2c7ed <+109>:  movq   -0x10(%rbp), %rsi
0x101d2c7f1 <+113>:  movq   (%rsi,%rax), %rdi
0x101d2c7f5 <+117>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c7fa <+122>:  movq   0x16def9f(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgWait : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2c801 <+129>:  movq   -0x10(%rbp), %rsi
0x101d2c805 <+133>:  movq   (%rsi,%rax), %rdi
0x101d2c809 <+137>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c80e <+142>:  movq   0x16def93(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewWaiting : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2c815 <+149>:  movq   -0x10(%rbp), %rsi
0x101d2c819 <+153>:  movq   (%rsi,%rax), %rdi
0x101d2c81d <+157>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c822 <+162>:  movq   0x16def87(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewBeforeCall : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2c829 <+169>:  movq   -0x10(%rbp), %rsi
0x101d2c82d <+173>:  movq   (%rsi,%rax), %rdi
0x101d2c831 <+177>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c836 <+182>:  movq   0x16def7b(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgAlpha : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2c83d <+189>:  movq   -0x10(%rbp), %rsi
0x101d2c841 <+193>:  movq   (%rsi,%rax), %rdi
0x101d2c845 <+197>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c84a <+202>:  movq   0x16def6f(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblTopic : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2c851 <+209>:  movq   -0x10(%rbp), %rsi
0x101d2c855 <+213>:  movq   (%rsi,%rax), %rdi
0x101d2c859 <+217>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c85e <+222>:  movq   0x16def63(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblTime : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2c865 <+229>:  movq   -0x10(%rbp), %rsi
0x101d2c869 <+233>:  movq   (%rsi,%rax), %rdi
0x101d2c86d <+237>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c872 <+242>:  movq   0x16def57(%rip), %rax     ; direct field offset for GopChat.CallViewController.btnHangup : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIButton>
0x101d2c879 <+249>:  movq   -0x10(%rbp), %rsi
0x101d2c87d <+253>:  movq   (%rsi,%rax), %rdi
0x101d2c881 <+257>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c886 <+262>:  movq   0x16def4b(%rip), %rax     ; direct field offset for GopChat.CallViewController.btnMicrophone : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIButton>
0x101d2c88d <+269>:  movq   -0x10(%rbp), %rsi
0x101d2c891 <+273>:  movq   (%rsi,%rax), %rdi
0x101d2c895 <+277>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c89a <+282>:  movq   0x16def3f(%rip), %rax     ; direct field offset for GopChat.CallViewController.btnSpeaker : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIButton>
0x101d2c8a1 <+289>:  movq   -0x10(%rbp), %rsi
0x101d2c8a5 <+293>:  movq   (%rsi,%rax), %rdi
0x101d2c8a9 <+297>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c8ae <+302>:  movq   0x16def33(%rip), %rax     ; direct field offset for GopChat.CallViewController.btnNext : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIButton>
0x101d2c8b5 <+309>:  movq   -0x10(%rbp), %rsi
0x101d2c8b9 <+313>:  movq   (%rsi,%rax), %rdi
0x101d2c8bd <+317>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c8c2 <+322>:  movq   0x16def27(%rip), %rax     ; direct field offset for GopChat.CallViewController.stackViewCalls : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIStackView>
0x101d2c8c9 <+329>:  movq   -0x10(%rbp), %rsi
0x101d2c8cd <+333>:  movq   (%rsi,%rax), %rdi
0x101d2c8d1 <+337>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c8d6 <+342>:  movq   0x16def1b(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewCall1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2c8dd <+349>:  movq   -0x10(%rbp), %rsi
0x101d2c8e1 <+353>:  movq   (%rsi,%rax), %rdi
0x101d2c8e5 <+357>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c8ea <+362>:  movq   0x16def0f(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewCall2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2c8f1 <+369>:  movq   -0x10(%rbp), %rsi
0x101d2c8f5 <+373>:  movq   (%rsi,%rax), %rdi
0x101d2c8f9 <+377>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c8fe <+382>:  movq   0x16def03(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewCall3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2c905 <+389>:  movq   -0x10(%rbp), %rsi
0x101d2c909 <+393>:  movq   (%rsi,%rax), %rdi
0x101d2c90d <+397>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c912 <+402>:  movq   0x16deef7(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewCall4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2c919 <+409>:  movq   -0x10(%rbp), %rsi
0x101d2c91d <+413>:  movq   (%rsi,%rax), %rdi
0x101d2c921 <+417>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c926 <+422>:  movq   0x16deeeb(%rip), %rax     ; direct field offset for GopChat.CallViewController.webv1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIWebView>
0x101d2c92d <+429>:  movq   -0x10(%rbp), %rsi
0x101d2c931 <+433>:  movq   (%rsi,%rax), %rdi
0x101d2c935 <+437>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c93a <+442>:  movq   0x16deedf(%rip), %rax     ; direct field offset for GopChat.CallViewController.webv2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIWebView>
0x101d2c941 <+449>:  movq   -0x10(%rbp), %rsi
0x101d2c945 <+453>:  movq   (%rsi,%rax), %rdi
0x101d2c949 <+457>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c94e <+462>:  movq   0x16deed3(%rip), %rax     ; direct field offset for GopChat.CallViewController.webv3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIWebView>
0x101d2c955 <+469>:  movq   -0x10(%rbp), %rsi
0x101d2c959 <+473>:  movq   (%rsi,%rax), %rdi
0x101d2c95d <+477>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c962 <+482>:  movq   0x16deec7(%rip), %rax     ; direct field offset for GopChat.CallViewController.webv4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIWebView>
0x101d2c969 <+489>:  movq   -0x10(%rbp), %rsi
0x101d2c96d <+493>:  movq   (%rsi,%rax), %rdi
0x101d2c971 <+497>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c976 <+502>:  movq   0x16deebb(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgAvatar1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2c97d <+509>:  movq   -0x10(%rbp), %rsi
0x101d2c981 <+513>:  movq   (%rsi,%rax), %rdi
0x101d2c985 <+517>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c98a <+522>:  movq   0x16deeaf(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblName1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2c991 <+529>:  movq   -0x10(%rbp), %rsi
0x101d2c995 <+533>:  movq   (%rsi,%rax), %rdi
0x101d2c999 <+537>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c99e <+542>:  movq   0x16deea3(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgLocation1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2c9a5 <+549>:  movq   -0x10(%rbp), %rsi
0x101d2c9a9 <+553>:  movq   (%rsi,%rax), %rdi
0x101d2c9ad <+557>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c9b2 <+562>:  movq   0x16dee97(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblCountry1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2c9b9 <+569>:  movq   -0x10(%rbp), %rsi
0x101d2c9bd <+573>:  movq   (%rsi,%rax), %rdi
0x101d2c9c1 <+577>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c9c6 <+582>:  movq   0x16dee8b(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgBg1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2c9cd <+589>:  movq   -0x10(%rbp), %rsi
0x101d2c9d1 <+593>:  movq   (%rsi,%rax), %rdi
0x101d2c9d5 <+597>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c9da <+602>:  movq   0x16dee7f(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgBg11 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2c9e1 <+609>:  movq   -0x10(%rbp), %rsi
0x101d2c9e5 <+613>:  movq   (%rsi,%rax), %rdi
0x101d2c9e9 <+617>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2c9ee <+622>:  movq   0x16dee73(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgReport1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2c9f5 <+629>:  movq   -0x10(%rbp), %rsi
0x101d2c9f9 <+633>:  movq   (%rsi,%rax), %rdi
0x101d2c9fd <+637>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ca02 <+642>:  movq   0x16dee67(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblReport1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2ca09 <+649>:  movq   -0x10(%rbp), %rsi
0x101d2ca0d <+653>:  movq   (%rsi,%rax), %rdi
0x101d2ca11 <+657>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ca16 <+662>:  movq   0x16dee5b(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgAvatar2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2ca1d <+669>:  movq   -0x10(%rbp), %rsi
0x101d2ca21 <+673>:  movq   (%rsi,%rax), %rdi
0x101d2ca25 <+677>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ca2a <+682>:  movq   0x16dee4f(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblName2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2ca31 <+689>:  movq   -0x10(%rbp), %rsi
0x101d2ca35 <+693>:  movq   (%rsi,%rax), %rdi
0x101d2ca39 <+697>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ca3e <+702>:  movq   0x16dee43(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgLocation2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2ca45 <+709>:  movq   -0x10(%rbp), %rsi
0x101d2ca49 <+713>:  movq   (%rsi,%rax), %rdi
0x101d2ca4d <+717>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ca52 <+722>:  movq   0x16dee37(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblCountry2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2ca59 <+729>:  movq   -0x10(%rbp), %rsi
0x101d2ca5d <+733>:  movq   (%rsi,%rax), %rdi
0x101d2ca61 <+737>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ca66 <+742>:  movq   0x16dee2b(%rip), %rax     ; direct field offset for GopChat.CallViewController.btnReport2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIButton>
0x101d2ca6d <+749>:  movq   -0x10(%rbp), %rsi
0x101d2ca71 <+753>:  movq   (%rsi,%rax), %rdi
0x101d2ca75 <+757>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ca7a <+762>:  movq   0x16dee1f(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgBg2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2ca81 <+769>:  movq   -0x10(%rbp), %rsi
0x101d2ca85 <+773>:  movq   (%rsi,%rax), %rdi
0x101d2ca89 <+777>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ca8e <+782>:  movq   0x16dee13(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgBg22 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2ca95 <+789>:  movq   -0x10(%rbp), %rsi
0x101d2ca99 <+793>:  movq   (%rsi,%rax), %rdi
0x101d2ca9d <+797>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2caa2 <+802>:  movq   0x16dee07(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgReport2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2caa9 <+809>:  movq   -0x10(%rbp), %rsi
0x101d2caad <+813>:  movq   (%rsi,%rax), %rdi
0x101d2cab1 <+817>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cab6 <+822>:  movq   0x16dedfb(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblReport2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2cabd <+829>:  movq   -0x10(%rbp), %rsi
0x101d2cac1 <+833>:  movq   (%rsi,%rax), %rdi
0x101d2cac5 <+837>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2caca <+842>:  movq   0x16dedef(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgAvatar3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cad1 <+849>:  movq   -0x10(%rbp), %rsi
0x101d2cad5 <+853>:  movq   (%rsi,%rax), %rdi
0x101d2cad9 <+857>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cade <+862>:  movq   0x16dede3(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblName3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2cae5 <+869>:  movq   -0x10(%rbp), %rsi
0x101d2cae9 <+873>:  movq   (%rsi,%rax), %rdi
0x101d2caed <+877>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2caf2 <+882>:  movq   0x16dedd7(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgLocation3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2caf9 <+889>:  movq   -0x10(%rbp), %rsi
0x101d2cafd <+893>:  movq   (%rsi,%rax), %rdi
0x101d2cb01 <+897>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cb06 <+902>:  movq   0x16dedcb(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblCountry3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2cb0d <+909>:  movq   -0x10(%rbp), %rsi
0x101d2cb11 <+913>:  movq   (%rsi,%rax), %rdi
0x101d2cb15 <+917>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cb1a <+922>:  movq   0x16dedbf(%rip), %rax     ; direct field offset for GopChat.CallViewController.btnReport3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIButton>
0x101d2cb21 <+929>:  movq   -0x10(%rbp), %rsi
0x101d2cb25 <+933>:  movq   (%rsi,%rax), %rdi
0x101d2cb29 <+937>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cb2e <+942>:  movq   0x16dedb3(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgBg3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cb35 <+949>:  movq   -0x10(%rbp), %rsi
0x101d2cb39 <+953>:  movq   (%rsi,%rax), %rdi
0x101d2cb3d <+957>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cb42 <+962>:  movq   0x16deda7(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgBg33 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cb49 <+969>:  movq   -0x10(%rbp), %rsi
0x101d2cb4d <+973>:  movq   (%rsi,%rax), %rdi
0x101d2cb51 <+977>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cb56 <+982>:  movq   0x16ded9b(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgReport3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cb5d <+989>:  movq   -0x10(%rbp), %rsi
0x101d2cb61 <+993>:  movq   (%rsi,%rax), %rdi
0x101d2cb65 <+997>:  callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cb6a <+1002>: movq   0x16ded8f(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblReport3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2cb71 <+1009>: movq   -0x10(%rbp), %rsi
0x101d2cb75 <+1013>: movq   (%rsi,%rax), %rdi
0x101d2cb79 <+1017>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cb7e <+1022>: movq   0x16ded83(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgAvatar4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cb85 <+1029>: movq   -0x10(%rbp), %rsi
0x101d2cb89 <+1033>: movq   (%rsi,%rax), %rdi
0x101d2cb8d <+1037>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cb92 <+1042>: movq   0x16ded77(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblName4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2cb99 <+1049>: movq   -0x10(%rbp), %rsi
0x101d2cb9d <+1053>: movq   (%rsi,%rax), %rdi
0x101d2cba1 <+1057>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cba6 <+1062>: movq   0x16ded6b(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgLocation4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cbad <+1069>: movq   -0x10(%rbp), %rsi
0x101d2cbb1 <+1073>: movq   (%rsi,%rax), %rdi
0x101d2cbb5 <+1077>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cbba <+1082>: movq   0x16ded5f(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblCountry4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2cbc1 <+1089>: movq   -0x10(%rbp), %rsi
0x101d2cbc5 <+1093>: movq   (%rsi,%rax), %rdi
0x101d2cbc9 <+1097>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cbce <+1102>: movq   0x16ded53(%rip), %rax     ; direct field offset for GopChat.CallViewController.btnReport4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIButton>
0x101d2cbd5 <+1109>: movq   -0x10(%rbp), %rsi
0x101d2cbd9 <+1113>: movq   (%rsi,%rax), %rdi
0x101d2cbdd <+1117>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cbe2 <+1122>: movq   0x16ded47(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgBg4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cbe9 <+1129>: movq   -0x10(%rbp), %rsi
0x101d2cbed <+1133>: movq   (%rsi,%rax), %rdi
0x101d2cbf1 <+1137>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cbf6 <+1142>: movq   0x16ded3b(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgBg44 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cbfd <+1149>: movq   -0x10(%rbp), %rsi
0x101d2cc01 <+1153>: movq   (%rsi,%rax), %rdi
0x101d2cc05 <+1157>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cc0a <+1162>: movq   0x16ded2f(%rip), %rax     ; direct field offset for GopChat.CallViewController.imgReport4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIImageView>
0x101d2cc11 <+1169>: movq   -0x10(%rbp), %rsi
0x101d2cc15 <+1173>: movq   (%rsi,%rax), %rdi
0x101d2cc19 <+1177>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cc1e <+1182>: movq   0x16ded23(%rip), %rax     ; direct field offset for GopChat.CallViewController.lblReport4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UILabel>
0x101d2cc25 <+1189>: movq   -0x10(%rbp), %rsi
0x101d2cc29 <+1193>: movq   (%rsi,%rax), %rdi
0x101d2cc2d <+1197>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cc32 <+1202>: movq   0x16ded17(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewReport1 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cc39 <+1209>: movq   -0x10(%rbp), %rsi
0x101d2cc3d <+1213>: movq   (%rsi,%rax), %rdi
0x101d2cc41 <+1217>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cc46 <+1222>: movq   0x16ded0b(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar11 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cc4d <+1229>: movq   -0x10(%rbp), %rsi
0x101d2cc51 <+1233>: movq   (%rsi,%rax), %rdi
0x101d2cc55 <+1237>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cc5a <+1242>: movq   0x16decff(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar12 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cc61 <+1249>: movq   -0x10(%rbp), %rsi
0x101d2cc65 <+1253>: movq   (%rsi,%rax), %rdi
0x101d2cc69 <+1257>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cc6e <+1262>: movq   0x16decf3(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar13 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cc75 <+1269>: movq   -0x10(%rbp), %rsi
0x101d2cc79 <+1273>: movq   (%rsi,%rax), %rdi
0x101d2cc7d <+1277>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cc82 <+1282>: movq   0x16dece7(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewReport2 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cc89 <+1289>: movq   -0x10(%rbp), %rsi
0x101d2cc8d <+1293>: movq   (%rsi,%rax), %rdi
0x101d2cc91 <+1297>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cc96 <+1302>: movq   0x16decdb(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar21 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cc9d <+1309>: movq   -0x10(%rbp), %rsi
0x101d2cca1 <+1313>: movq   (%rsi,%rax), %rdi
0x101d2cca5 <+1317>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ccaa <+1322>: movq   0x16deccf(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar22 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2ccb1 <+1329>: movq   -0x10(%rbp), %rsi
0x101d2ccb5 <+1333>: movq   (%rsi,%rax), %rdi
0x101d2ccb9 <+1337>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ccbe <+1342>: movq   0x16decc3(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar23 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2ccc5 <+1349>: movq   -0x10(%rbp), %rsi
0x101d2ccc9 <+1353>: movq   (%rsi,%rax), %rdi
0x101d2cccd <+1357>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ccd2 <+1362>: movq   0x16decb7(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewReport3 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2ccd9 <+1369>: movq   -0x10(%rbp), %rsi
0x101d2ccdd <+1373>: movq   (%rsi,%rax), %rdi
0x101d2cce1 <+1377>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cce6 <+1382>: movq   0x16decab(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar31 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cced <+1389>: movq   -0x10(%rbp), %rsi
0x101d2ccf1 <+1393>: movq   (%rsi,%rax), %rdi
0x101d2ccf5 <+1397>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2ccfa <+1402>: movq   0x16dec9f(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar32 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cd01 <+1409>: movq   -0x10(%rbp), %rsi
0x101d2cd05 <+1413>: movq   (%rsi,%rax), %rdi
0x101d2cd09 <+1417>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cd0e <+1422>: movq   0x16dec93(%rip), %rax     ; direct field offset for GopChat.CallViewController.reportBar33 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cd15 <+1429>: movq   -0x10(%rbp), %rsi
0x101d2cd19 <+1433>: movq   (%rsi,%rax), %rdi
0x101d2cd1d <+1437>: callq  0x102b63130               ; symbol stub for: objc_release
0x101d2cd22 <+1442>: movq   0x16dec87(%rip), %rax     ; direct field offset for GopChat.CallViewController.viewReport4 : Swift.ImplicitlyUnwrappedOptional<__ObjC.UIView>
0x101d2cd29 <+1449>: movq   -0x10(%rbp), %rsi
0x101d2cd2d <+1453>: movq   (%rsi,%rax), %rdi
0x101d2cd31 <+1457>: callq  0x102b63130               ; symbol stub    

我尝试了 NSZombie,但找不到任何东西。我会感谢你的帮助。

当我在 viewDidLoad() 中注释以下行时,没有崩溃

localAudioTrack = peerConnectionFactory.audioTrack(withTrackId: uuid!)
mediaStream = peerConnectionFactory.mediaStream(withStreamId: LOCAL_MEDIA_STREAM_ID)
mediaStream.addAudioTrack(localAudioTrack)

这是这些变量的声明

private var mediaStream: RTCMediaStream!
private var localAudioTrack: RTCAudioTrack!
private var dataChannel: RTCDataChannel!

【问题讨论】:

请发布控制台输出 控制台没有错误信息。 添加异常断点试试!!!:) @BrijeshShiroya 我已经添加了异常断点。 在哪一行断点停止? 【参考方案1】:

尝试使 mediaStream 和 localAudioTrack 变量变弱。这将创建指向它们的弱指针,如果不再有对象引用它们,它们就会从堆栈中释放。也弱将使它们一旦被释放就可能变为 nil。

【讨论】:

我应该分享哪个代码?整节课很长。可能会超过 SO 的字符数限制。 绝对不是整个班级 :) 我推测您有一些异步运行的完成处理程序/闭包,当您关闭它们时,它们会返回并尝试引用 self(到那时已被销毁)所以在这些情况下,我在我的闭包中使用 [weak self] 使 self 成为可选的,并且如果它不再存在则不会使应用程序崩溃。如果能找到这些闭包的任何案例,您可以发布它们或者只是在那里尝试弱自我。 我发布了一个异步调用的 onOffer 函数。您能告诉我如何在其中添加[弱自我]吗?再次感谢。 所以你不会将弱自我添加到函数中,而是添加到调用 onOffer 的闭包中。检查从哪里调用它,例如SomeClass.somefunction(completion: self.onOffer() ) 你的意思是(例如) DispatchQueue.main.async self.setCallerHidden(view1: self.viewCall2, reason: reason, name: self.lblName2.text ?? "No name") self .counter2 = 0 TO DispatchQueue.main.async [weak self] in self?.setCallerHidden(view1: (self?.viewCall2)!, reason: reason, name: self?.lblName2.text ?? "No name" ) self?.counter2 = 0

以上是关于在 WebRTC 库中关闭视图控制器时出现 EXC_BAD_ACCESS 错误时崩溃的主要内容,如果未能解决你的问题,请参考以下文章

在朋友墙上发布消息时出现集成错误?

在 UITabController 中关闭视图控制器

如何在 appdelegate 中关闭视图控制器?

在附加的视图控制器中关闭 Popover segue

在 iOS 8 中关闭模式视图控制器时 UI 会失真

如何检查视图控制器是不是已在 Swift 中关闭