ios – Multipeer Connectivity: [GCKSession] Not in related state

[ad_1]

I’m utilizing the Multipeer Connectivity framework to attach a number of customers in my app. When I attempt to invite customers through the MCBrowserViewController, it really works. Nonetheless, when I attempt to ship knowledge I get the next error:

2022-10-29 13:13:30.159840+0200 Break up[72183:5177674] [MCNearbyServiceAdvertiser] We try to ship knowledge to look [iPhone,0D8E401A] and we're not related.
2022-10-29 13:13:38.313487+0200 Break up[72183:5177663] [GCKSession] Not in related state, so giving up for participant [0D8E401A] on channel [0].

That is my code to ship knowledge:

func sendPayData(totalUser: String) {
        if mcSession.connectedPeers.depend > 0 {
                do {
                    strive mcSession.ship(totalUser.knowledge(utilizing: .ascii)!, toPeers: mcSession.connectedPeers, with: .dependable)
                    
} catch let error as NSError {
                    let ac = UIAlertController(title: "Ship error", message: error.localizedDescription, preferredStyle: .alert)
                    ac.addAction(UIAlertAction(title: "OK", model: .default))
                    current(ac, animated: true)
                }
        }
    }

One answer on the Apple Developer Discussion board was to set the encryptionPreference to .none within the MCSession. This didn’t assist me both. Some additionally say that they’ll ship knowledge regardless of this error. Not for me, sadly, because it appears to be like.

I discovered a number of questions on this error on Reddit, however they weren’t answered there. I’d be very grateful if somebody might assist me.

[ad_2]

Leave a Reply