Devhess Devhess - 1 year ago 532
iOS Question

Type 'UIViewController' does not conform to protocol 'WCSessionDelegate'

Since upgrading on Xcode 8 (Beta 1) and Swift 3 I have an error in this line:

class CloudViewController: UIViewController, WCSessionDelegate {

It says :

Type 'UIViewController' does not conform to protocol

This is my (with Xcode 8 and Swift 3 working) code:

override func viewDidLoad() {

self.session = WCSession.default()
self.session.delegate = self

func session(_ session: WCSession, didReceiveMessage message: [String : AnyObject]) {




This error also shows up in the WKInterfaceController classes.

Answer Source

Every protocol comes with a set of methods that you are supposed to implement in order to conform to them. You must write those methods in your class to conform to it.

For example, in a UIViewController, if you decide to have a tableView, you must add the UITableViewDataSource, UITableViewDelegate protocol. And to actually have your View Controller conform to the protocol, you will have to implement two methods, namely: cellForRowAtIndexPath andnumberOfRowsInSection

Therefore, you must look into the documentation and find what methods does this protocol require the class to implement. That should solve this problem. And I don't think it is to do anything with Xcode 8 or swift 3

EDIT Here: This is what apple documentation says

Most methods of this protocol are optional. You implement the methods you need to respond to the data transfer operations that your apps support. However, apps should implement support for the session:activationDidCompleteWithState:error: method to support asynchronous activation, and the delegate in your iPhone app should implement the sessionDidBecomeInactive: and sessionDidDeactivate: methods to support multiple Apple Watches.