opentok / opentok-flutter-basic-video-chat

11 stars 6 forks source link

Crash when calling notifyFlutter(SdkState) on AppDelegate #10

Open arvie9 opened 2 years ago

arvie9 commented 2 years ago

I noticed when I'm in session, when I call notifyFlutter(SdkState) when a stream is destroyed or on disconnect, I get this error:

`A stream was destroyed in the session. 2022-03-24 08:12:59.804943-0700 Runner[16420:11706611] flutter: SDK state: SdkState.LOGGED_OUT 2022-03-24 08:12:59.829684-0700 Runner[16420:11706097] -[NSDictionaryM longLongValue]: unrecognized selector sent to instance 0x600002c6c420 2022-03-24 08:12:59.862868-0700 Runner[16420:11706097] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSDictionaryM longLongValue]: unrecognized selector sent to instance 0x600002c6c420'

*** First throw call stack: ( 0 CoreFoundation 0x00007fff203feba4 exceptionPreprocess + 242 1 libobjc.A.dylib 0x00007fff201a1be7 objc_exception_throw + 48 2 CoreFoundation 0x00007fff2040d811 +[NSObject(NSObject) instanceMethodSignatureForSelector:] + 0 3 CoreFoundation 0x00007fff204030ac __forwarding + 1433 4 CoreFoundation 0x00007fff204051d8 _CF_forwarding_prep_0 + 120 5 Flutter 0x0000000105c6558e _ZN7flutter30FlutterPlatformViewsController9OnDisposeEP17FlutterMethodCallRU13block_pointerFvP11objc_objectE + 52 6 Flutter 0x0000000105c5d9b6 47-[FlutterEngine maybeSetupPlatformViewChannels]_block_invoke.165 + 120 7 Flutter 0x00000001061dd891 45-[FlutterMethodChannel setMethodCallHandler:]_block_invoke + 104 8 Flutter 0x0000000105c86c3d _ZNK7flutter21PlatformMessageRouter21HandlePlatformMessageENSt3110unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE + 193 9 Flutter 0x0000000105c8c2f7 _ZN7flutter15PlatformViewIOS21HandlePlatformMessageENSt3110unique_ptrINS_15PlatformMessageENS1_14default_deleteIS3_EEEE + 35 10 Flutter 0x00000001060b76b9 _ZNSt3110function6funcIN3fml8internal14CopyableLambdaIZN7flutter5Shell29OnEngineHandlePlatformMessageENS_10unique_ptrINS5_15PlatformMessageENS_14default_deleteIS8_EEEEE4$_16EENS_9allocatorISD_EEFvvEEclEv + 81 11 Flutter 0x0000000105fbc856 _ZN3fml15MessageLoopImpl10FlushTasksENS_9FlushTypeE + 164 12 Flutter 0x0000000105fc2d08 _ZN3fml17MessageLoopDarwin11OnTimerFireEP16CFRunLoopTimerPS0_ + 26 13 CoreFoundation 0x00007fff2036d6b6 CFRUNLOOP_IS_CALLING_OUT_TO_A_TIMER_CALLBACK_FUNCTION + 20 14 CoreFoundation 0x00007fff2036d1b2 CFRunLoopDoTimer + 923 15 CoreFoundation 0x00007fff2036c771 CFRunLoopDoTimers + 265 16 CoreFoundation 0x00007fff20366db0 __CFRunLoopRun + 2010 17 CoreFoundation 0x00007fff203660f3 CFRunLoopRunSpecific + 567 18 GraphicsServices 0x00007fff2c995cd3 GSEventRunModal + 139 19 UIKitCore 0x00007fff25059f42 -[UIApplication _run] + 928 20 UIKitCore 0x00007fff2505eb5e UIApplicationMain + 101 21 Runner 0x00000001021733ef main + 63 22 dyld 0x0000000103050ee9 start_sim + 10 23 ??? 0x0000000000000001 0x0 + 1 24 ??? 0x0000000000000001 0x0 + 1 )

libc++abi: terminating with uncaught exception of type NSException dyld4 config: DYLD_ROOT_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot DYLD_LIBRARY_PATH=/Users/arvie/Library/Developer/Xcode/DerivedData/Runner-elpnaoesejsaltgdkktsihmtupns/Build/Products/Debug-iphonesimulator:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/system/introspection DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libBacktraceRecording.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMainThreadChecker.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/usr/lib/libMTLCapture.dylib:/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS.simruntime/Contents/Resources/RuntimeRoot/Developer/Library/PrivateFrameworks/DTDDISupport.framework/libViewDebuggerSupport.dylib DYLD_FRAMEWORK_PATH=/Users/arvie/Library/Developer/Xcode/DerivedData/Runner-elpnaoesejsaltgdkktsihmtupns/Build/Products/Debug-iphonesimulator *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM longLongValue]: unrecognized selector sent to instance 0x600002c6c420' terminating with uncaught exception of type NSException`

arvie9 commented 2 years ago

Going deeper, it seems that this happens when setState() and _sdkState is changed once initSession has kicked in. If not initialized, the methodCallHandler works as expected.