opentok / opentok-ios-sdk-samples-swift

Sample applications using the OpenTok iOS SDK in Swift
https://tokbox.com/
MIT License
137 stars 65 forks source link

app crash when call session?.disconnect(&error) #155

Closed mhdHasanAlgnadi closed 1 year ago

mhdHasanAlgnadi commented 3 years ago

I setup everything and do a video call and everything is fine but when I try to disconnect the session the app crash and send this error Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSDictionaryM longLongValue]: unrecognized selector sent to instance 0x283e4c080' I use sdk 2.20.0 on flutter app

adil-nangyal commented 2 years ago

did you get any solution for that I am also stuck on this issue?

fabiocody commented 2 years ago

Same problem here, it happens also on 2.21.2 and 2.21.3

dweberlj commented 2 years ago

Hello @mhdHasanAlgnadi @fabiocody did you find a resolution to this issue? Thanks.

fabiocody commented 2 years ago

I honestly didn't even remember about this error, all I can say is that everything is working fine with latest OpenTok and Flutter versions. Are you still having this issue?

dweberlj commented 2 years ago

Hi @fabiocody, I'm using opentok 2.21.3 and in my flutter (v3) app I open a new route (page) to display the video from my main menu. That works, when I navigate back to my main menu (Navigator.of(context).pop()) I get this error.

When I use the latest opentok 2.23.1 I get a crash when opentok starts. My opentok code is based on this example https://pub.dev/packages/flutter_vonage_video/example

What versions of Flutter and opentok are you using or maybe you're not using Flutter and writing a native iOS app instead?

Thanks!

fabiocody commented 2 years ago

I'm using Flutter 3.3.3 and OpenTok 2.23.1. My code is based on this example https://github.com/opentok/opentok-flutter-basic-video-chat

dweberlj commented 2 years ago

Correction, that is the code base that I'm using too.

Did you have to modify the main.dart code for Flutter v3? I had to change add Platform.Android check and use PlatformViewSurface for iOS.

https://github.com/opentok/opentok-flutter-basic-video-chat/blob/a055399aaa15055e5eca6126ce44b81e40c8dfec/lib/main.dart#L166-L171

            child: PlatformViewLink(
              viewType: 'opentok-video-container', // custom platform-view-type
              surfaceFactory: (BuildContext context, PlatformViewController controller) {
                if (Platform.isAndroid) {
                  return AndroidViewSurface(
                    controller: controller,
                    gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
                    hitTestBehavior: PlatformViewHitTestBehavior.opaque,
                  );
                } else {
                  return PlatformViewSurface(
                    controller: controller,
                    gestureRecognizers: const <Factory<OneSequenceGestureRecognizer>>{},
                    hitTestBehavior: PlatformViewHitTestBehavior.opaque,
                  );
                }
              },