I have made an application for iOS device to get the heart rate data continuously from the watch. It is working as intended and I wanted to add a test case checking if the watch is connected (paired) with the device. My code for testing it is:
if WCSession.isSupported() {
let wcsession = WCSession.default
wcsession.delegate = self as? WCSessionDelegate
wcsession.activate()
if(wcsession.isPaired){
print("paired")
}else{
print("not paired")
}
}
However, I get an error:
2020-02-29 15:25:55.044843+0900 HeartRateApp[68975:11196372] [WC] denying activation due to missing delegate
2020-02-29 15:25:55.044969+0900 HeartRateApp[68975:11196372] [WC] WCSession has not been activated
even though everything is working and I receive the data from the watch successfully...
I have looked at other questions here but they all have similar solutions: