简体   繁体   中英

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM