MCBrowserViewController shouldn't receive this callback message in browser?

Viewed 247

I am toying around with Multipeer Connectivity and I see (error?) messages that I cannot figure out why it appears. It seems to slow down the connection between two peers as well.

I have setup MPC in a separate class and delegate the McBrowser to my GameScene, because I need to show the browser from there, like so;

extension GameScene: MCBrowserViewControllerDelegate {

     func browserViewControllerDidFinish(_ browserViewController: MCBrowserViewController) {
           browserViewController.dismiss(animated: true, completion: nil)
    }

    func browserViewControllerWasCancelled(_ browserViewController: MCBrowserViewController) {
      browserViewController.dismiss(animated: true, completion: nil)
    }
}

Then in touchesBegan I can start the McBrowser to host or 'simply' join a session.

     ...
    //
    if node.name == "join_connection" {
        multipeerSession!.advertiseSelf()
    }

    if node.name == "host_connection" {multipeerSession!.setupBrowser()
        multipeerSession!.browser.delegate = self

        DispatchQueue.main.async {
            let vc = self.view?.window!.rootViewController!
            vc?.self.present(multipeerSession!.browser, animated: true, completion: nil)
        }
    }
   //
    ......

The odd thing is that when peers are connected, when data is received the browser shows ; "[MCBrowserViewController] MCBrowserViewController shouldn't be receiving this callback"

and not just once, but every time data is received. The message is also not appearing every time I run my application but every so now and then.

I should mention that I receive my data also in GameScene using a completion handler;

..
//
   func receivedData(_ data: Data, from peer: MCPeerID) {
// do stuff with data here
   }
//
..

Does anyone have any idea? Because Google only shows a few mentionings of this message but nobody is discussing this (error) message..

thanks, J

0 Answers
Related