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 7 and Swift 2 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.
With Swift 3, you should implement this methods according to the new protocol
session:activationDidCompleteWithState:error:
sessionDidBecomeInactive:
sessionDidDeactivate:
because they are not marked as optional on protocol anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With