I try use WatchManager.swift in exists project.
import Foundation
import WatchConnectivity
class WatchManager: NSObject, WCSessionDelegate {
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
}
func sessionDidBecomeInactive(_ session: WCSession) {
}
func sessionDidDeactivate(_ session: WCSession) {
}
}
but I have trouble on build my project
Swift Compiler Error Group - Type 'WatchManager' does not conform to protocol 'WCSessionDelegate'
Also in issue navigator i see error
Candidate has non-matching type '(WCSession, WCSessionActivationState, Error?) -> ()'
I already tried:
but i get this error everytime
BUT! If I will create new project and add watchOS target and create new file with this code - project will build successfully.
Why? How i can try to add WCSessionDelegate in my exists project?
I use Xcode9.2, swift4.0
Oh... Thank @Sameer for answer
WCSessionDelegate has required method
public func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?)
but my project there is my custom class with name Error
that's why the compiler produced an error that does not conform to protocol
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.