frank
frank

Reputation: 11

Type 'ViewController' does not conform to protocol 'MCSessionDelegate'

i want to write a simple code to test "MultipeerConnectivity" so i use Type 'ViewController' to inherit "MCSessionDelegate" and "MCBrowserViewControllerDelegate"

but swift always say error like Type 'ViewController' does not conform to protocol 'MCSessionDelegate'

i see oc code it is easy to realize it,why i change to swift ,it become wrong?

Upvotes: 0

Views: 939

Answers (1)

Kireyin
Kireyin

Reputation: 162

The does not conform to protocol error appears when you don't implement the required methods of this protocol.

In that case, to conform to the MCSessionDelegate you need to implement session:didReceiveData:fromPeer:, session:didStartReceivingResourceWithName:fromPeer:withProgress:, session:didFinishReceivingResourceWithName:fromPeer:atURL:withError:, session:didReceiveStream:withName:fromPeer: and session:peer:didChangeState:

Take a look at the documentation here, it lists all the required methods for the delegate.

Upvotes: 3

Related Questions