0

I am connecting with the signaling server using an AppRTC Peer to peer connection. I use WebRTC Framework. All file & classes are working fine and the setup seems correct.

But when I call this webRTC class in my videoViewController, the application crashes with this error message:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Swift._NSContiguousString key]: unrecognized selector sent to instance 0x2805b5d00'

which indicates that some value is nil, or not declared. But I am not able to find which value is nil or not declared in AppRTC Peer to peer connection class.

Any help would be appreciated to find why.

Swift language:

fileprivate let audioCallConstraint = RTCMediaConstraints(mandatoryConstraints: ["OfferToReceiveAudio" : "true"], optionalConstraints: nil)

fileprivate let videoCallConstraint = RTCMediaConstraints(mandatoryConstraints: ["OfferToReceiveAudio" : "true", "OfferToReceiveVideo": "true"], optionalConstraints: nil)

Message:

Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[Swift._NSContiguousString key]: unrecognized selector sent to instance 0x2805b5d00'

Nic3500
  • 8,144
  • 10
  • 29
  • 40
  • According to `https://github.com/otalk/webrtc-ios/blob/master/include/RTCMediaConstraints.h`, `mandatoryConstraints` needs to be an Array, not a Dictionary. So I guess `RTCMediaConstraints(mandatoryConstraints: ["OfferToReceiveAudio" : "true"], optionalConstraints: nil)` => `RTCMediaConstraints(mandatoryConstraints: [["OfferToReceiveAudio" : "true"]], optionalConstraints: nil)` and `fileprivate let videoCallConstraint = RTCMediaConstraints(mandatoryConstraints: [["OfferToReceiveAudio" : "true"], ["OfferToReceiveVideo": "true"]], optionalConstraints: nil)` – Larme Oct 12 '18 at 10:33
  • Rewrote much of the text, title and formatted code. – Nic3500 Oct 12 '18 at 21:10

0 Answers0