ConnectyCube / connectycube-ios-calls-sdk-releases

Releases packages for ConnectyCube iOS Calls SDK platform
https://connectycube.com
3 stars 1 forks source link

-[UIView setVideoTrack:]: unrecognized selector sent to instance 0x7ff0bb62e090 #4

Open iamimsh opened 4 years ago

iamimsh commented 4 years ago

Hello @DaveLomber

I'm using an UIView and set its class to CallRemoteVideoView

    @IBOutlet weak var otherCamView: CallRemoteVideoView!

Now,

func session(_ session: CallBaseSession, receivedRemoteVideoTrack videoTrack: CallVideoTrack, fromUser userID: NSNumber) {
        self.otherCamView.setVideoTrack(videoTrack)
}

When I do this, it crashes the app. Here's the crash log.

2020-03-07 16:11:48.990818+0300 DemoAppNam[14359:253865] -[UIView setVideoTrack:]: unrecognized selector sent to instance 0x7ff0bb62e090
2020-03-07 16:11:48.997166+0300 DemoAppNam[14359:253865] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIView setVideoTrack:]: unrecognized selector sent to instance 0x7ff0bb62e090'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff23c7127e __exceptionPreprocess + 350
    1   libobjc.A.dylib                     0x00007fff513fbb20 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff23c91fd4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
    3   UIKitCore                           0x00007fff480c0f17 -[UIResponder doesNotRecognizeSelector:] + 302
    4   CoreFoundation                      0x00007fff23c75c4c ___forwarding___ + 1436
    5   CoreFoundation                      0x00007fff23c77f78 _CF_forwarding_prep_0 + 120
    6   DemoAppNam                          0x0000000101cead8d $s10DemoAppNam10VIDEO_CALLC24receivedRemoteVideoTrack05videoG0ySo07CYBCallfG0C_tF + 477
    7   DemoAppNam                          0x0000000101ceb5f9 $s10DemoAppNam10VIDEO_CALLCAA23ConnectyManagerDelegateA2aDP24receivedRemoteVideoTrack05videoJ0ySo07CYBCalliJ0C_tFTW + 9
    8   DemoAppNam                          0x0000000101f361ca $s10DemoAppNam19ConnectyCubeManagerC7session_24receivedRemoteVideoTrack8fromUserySo18CYBCallBaseSessionC_So0lhI0CSo8NSNumberCtF + 810
    9   DemoAppNam                          0x0000000101f36276 $s10DemoAppNam19ConnectyCubeManagerC7session_24receivedRemoteVideoTrack8fromUserySo18CYBCallBaseSessionC_So0lhI0CSo8NSNumberCtFTo + 118
    10  CoreFoundation                      0x00007fff23c7820c __invoking___ + 140
    11  CoreFoundation                      0x00007fff23c753af -[NSInvocation invoke] + 319
    12  CoreFoundation                      0x00007fff23c75684 -[NSInvocation invokeWithTarget:] + 68
    13  ConnectyCube                        0x000000010487e5a7 CYB_sortItems + 89364
    14  libdispatch.dylib                   0x0000000106776dd4 _dispatch_call_block_and_release + 12
    15  libdispatch.dylib                   0x0000000106777d48 _dispatch_client_callout + 8
    16  libdispatch.dylib                   0x0000000106785de6 _dispatch_main_queue_callback_4CF + 1500
    17  CoreFoundation                      0x00007fff23bd4049 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
    18  CoreFoundation                      0x00007fff23bceca9 __CFRunLoopRun + 2329
    19  CoreFoundation                      0x00007fff23bce066 CFRunLoopRunSpecific + 438
    20  GraphicsServices                    0x00007fff384c0bb0 GSEventRunModal + 65
    21  UIKitCore                           0x00007fff48092d4d UIApplicationMain + 1621
    22  DemoAppNam                          0x0000000102298358 main + 72
    23  libdyld.dylib                       0x00007fff5227ec25 start + 1
    24  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

Could you please help on this?

DaveLomber commented 4 years ago

@iamimsh I believe the issue is with storyboard settings

please make sure you set a custom view class (CallRemoteVideoView) there for your view (see a screenshot)

Screen Shot 2020-03-10 at 12 52 43 PM
iamimsh commented 4 years ago

@DaveLomber , Yes I already did that...

After setting the class to my view, I dragged a link from that view in storyboard to my class which results in

@IBOutlet weak var otherCamView: CallRemoteVideoView!

And it still crashes.

DaveLomber commented 4 years ago

Seems it's still something wrong with Storyboard settings

as it says it's a UIView here [UIView setVideoTrack:]: and not a CallRemoteVideoView which in fact has a method - (void)setVideoTrack:(CallVideoTrack *)videoTrack;

can you log the otherCamView's class and double check, e.g.

let t = type(of: otherCamView)
print("'\(value)' of type '\(t)'")
iamimsh commented 4 years ago

Okay, let me try this and I'll let you know...

iamimsh commented 4 years ago

@DaveLomber , Here's what it printed

value of type 'Optional<CYBCallRemoteVideoView>'
DaveLomber commented 4 years ago

So it's ok but this is so strange...

Here is the class interface in SDK:

NS_SWIFT_NAME(CallRemoteVideoView)
@interface CYBCallRemoteVideoView : UIView <RTCVideoRenderer>

@property (nonatomic, assign, class) BOOL preferMetal;

@property (nonatomic, weak) id<CYBCallRemoteVideoViewDelegate> delegate;

@property (nonatomic, copy) NSString *videoGravity;

- (void)setVideoTrack:(CYBCallVideoTrack *)videoTrack;

@end

so the method is here

iamimsh commented 4 years ago

Yes, that's strange. But I realized something, when I'm trying to set the class name for UIView, it doesn't auto complete... So somehow it doesn't recognize CallRemoteVideoView

May be that's the problem.. @DaveLomber is there anything I could do for this?

DaveLomber commented 4 years ago

@iamimsh can you try to set it to CYBCallRemoteVideoView ?

iamimsh commented 4 years ago

Yes I tried to set to CYBCallRemoteVideoView. It doesn't work... It doesn't auto complete..

marab2 commented 4 years ago

@DaveLomber Can you please help us on this one?

DaveLomber commented 4 years ago

@iamimsh let me do more tests tomorrow in my test environment and I will get back to you asap

marab2 commented 4 years ago

Hi @DaveLomber Any update please?

DaveLomber commented 4 years ago

Hi @marab2 @iamimsh

We have reproduced the issue and the strangest thing is that the standard Xcode Storyboard feature of UIVIew custom class just stopped working.

We tried diff solutions but still no understanding what it does not work..

What I can propose for now - is to create a CallRemoteVideoView manually inside view controller

e.g.

   private var videoView: CallRemoteVideoView?

   ...

    videoView = CallRemoteVideoView()
    videoView!.videoGravity = AVLayerVideoGravity.resizeAspect.rawValue
    videoView!.clipsToBounds = true

    self.view.insertSubview(videoView!, at: 0)

    videoView!.translatesAutoresizingMaskIntoConstraints = false

    // add more styles/constraints as required 

     ...

    // then we can add a track 
    videoView!.setVideoTrack(videoTrack)

In this case everything works as expected, no crashes

We will investigate the 'unrecognized selector' issue later, so you can use the above solution for now

iamimsh commented 4 years ago

Great! This way works fine without crash..

videoView!.videoGravity = AVLayerVideoGravity.resizeAspectFill.rawValue

This doesn't work though...

marab2 commented 4 years ago

@DaveLomber We do appreciate your help on this, we are on the latest stages of start using Connectycub, please support us on solving the issues that we are facing so we can start using it.

DaveLomber commented 4 years ago

@iamimsh you can set any properties to the view Just use this approach as a basis - to create a view in code, not via Storyboard