Search code examples
iosswiftprotocolsmultipeer-connectivity

Swift - MultipeerConnectivity Type does not conform to protocol


I am trying out this tutorial and having some problem with the code:

class MPCManager: NSObject, MCSessionDelegate, MCNearbyServiceBrowserDelegate, MCNearbyServiceAdvertiserDelegate {

I got an error:

Type 'MPCManager' does not comform to protocol 'MCSessionDelegate'

Type 'MPCManager' does not comform to protocol 'MCNearbyServiceBrowserDelegate'

Type 'MPCManager' does not comform to protocol 'MCNearbyServiceAdvertiserDelegate'

But I download the sample file it did not get the same error. Which part had I missed out?


Solution

  • You need to implement all the required delegate methods of MCSessionDelegate and MCNearbyServiceBrowserDelegate and MCNearbyServiceAdvertiserDelegate, if you want to conform to these protocols.