上下文:我正在尝试从iOS应用程序向WatchOS应用程序发送消息。
无论我尝试哪种配置,我都无法获得
session.isReachable == true
Code=7007 "WatchConnectivity session on paired device is not reachable."
以下是我在iOS端的设置:
func detectIfAppleWatchPaired() { //called at the VC's viewDidLoad
if WCSession.isSupported() {
let session = WCSession.default
session.delegate = self
session.activate() // activate the session
}
}
func session(_ session: WCSession, activationDidCompleteWith activationState: WCSessionActivationState, error: Error?) {
if activationState == .activated && session.isPaired {
if session.isReachable {
print ("Success. I am able to reach the watch")
} else {
print ("CANNOT REACH") //This always happens
//Omitted code that sends message to the watch
}
}
}
我是不是在iOS的手表设置方面遗漏了什么?