Hiền Đỗ
Hiền Đỗ

Reputation: 546

had trouble handling threads in swift

I am developing a group call application, after I receive ice I have the following problem:

enter image description here

Thread 1: EXC_BAD_ACCESS (code=1, address=0x40)

Is there any way to solve this? enter image description here [enter image description here] [enter image description here]4

Upvotes: 0

Views: 51

Answers (1)

LinusG.
LinusG.

Reputation: 28892

It seems that either participantJoineds has no element at the first index, or .remotePeer is nil.

You should change the line to:

if participantJoindeds.first?.remotePeer?.remoteDescription != nil {

or even better:

if let description = participantJoindeds.first?.remotePeer?.remoteDescription {

If the method should end after this statement has been evaluated, you could also do:

guard let description = participantJoindeds.first?.remotePeer?.remoteDescription else { 
    participantJoindeds.first?.arrIceCandidate?.append(iceCandidate)
    return
}

Upvotes: 2

Related Questions