1

I have recently started working on the P2P video calling feature using Quickblox SDK. I have been following their documentation for the video calling implementation which is vague enough for any beginner to understand. Even though I have implemented it as mentioned in the documentation, I am facing an issue

When a call is initiated, the didReceiveNewSession method is not getting invoked at the receiving end device and later encounters a crash responding as below:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFConstantString count]: unrecognized selector sent to instance 0x10526bc10'

I have checked the below links and tried different combinations to solve the problem:

In didFinishLaunchingWithOptions of AppDelegate :

QBRTCClient.initializeRTC()

In viewDidLoad of ChatViewController :

override func viewDidLoad() {
  super.viewDidLoad()
  QBChat.instance.addDelegate(self)
  self.chatManager.connect() { _ in
      QBRTCClient.instance().add(self)
  }  
}

Delegate method of QBRTCClientDelegate protocol (Not getting invoked):

func didReceiveNewSession(_ session: QBRTCSession, userInfo: [String : String]? = nil) {
    print("[ChatViewContoller] didReceiveNewSession; userInfo: \(userInfo ?? ["value":"NA"])")
    if self.session != nil {
           // we already have a video/audio call session, so we reject another one
           // userInfo - the custom user information dictionary for the call from caller. May be nil.
           let userInfo = [String:String]() // optional
           session.rejectCall(userInfo)
           return
       }
       // saving session instance here
       self.session = session
}

Delegate method of QBRTCClientDelegate (Getting invoked strangely and shows state as Pending) :

func session(_ session: QBRTCBaseSession, didChange state: QBRTCSessionState) {
    var stateStr = String()
        
    switch state {
    case .new: stateStr = "New"
    case .connecting: stateStr = "Connecting"
    case .connected: stateStr = "Connected"
    case .pending: stateStr = "Pending"
    case .closed: stateStr = "Closed"
    default: stateStr = "Default case"
    }
        
    print("[ChatViewContoller] didChange; state: \(stateStr)")
}

Please let me know if I am missing anything in the implemented process and guide me through it. Thanks in advance.

4

0 回答 0