mardi 26 juillet 2016

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 'WCSessionDelegate'

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

override func viewDidLoad() {
    super.viewDidLoad()

    if(WCSession.isSupported()){
        self.session = WCSession.default()
        self.session.delegate = self
        self.session.activate()
    }
}

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

    print("didReceiveMessage")

    watchMessageHandler.getMessage(message)

}

This error also shows up in the WKInterfaceController classes.

Aucun commentaire:

Enregistrer un commentaire