Search code examples
iosapple-watchwatchos

How to deactivate the WatchConnectivity session?


I am using Apple's WatchConnectivity framework to develop an iOS app with a companion WatchOS app.

On iOS side, after I open the app, I need to manually activate the WCSession to communicate with the Apple Watch like this

if ([WCSession isSupported]) {
    self.wcSession = [WCSession defaultSession];
    self.wcSession.delegate = self;
    [self.wcSession activateSession];
}

After I finish all necessary communications between the iPhone and the Apple Watch, I want to deactivate the WCSession since the activation of WCSession is energy consuming. I have looked through the WatchConnectivity API but haven't found a way to deactivate it. I cannot shutdown the connection unless I quit the app on the iPhone and reopen it again.

Is there a way to deactivate the WCSession? Thank you very much.


Solution

  • Thanks to @Paulw11, I think there is no way to deactivate the WCSession once it has been activated.