Instance Method

sessionDidDeactivate:

Called after all data from the previous session has been delivered and communication with the Apple Watch has ended.

Required.

Declaration

- (void)sessionDidDeactivate:(WCSession *)session;

Parameters

session

The session object whose activation state changed.

Discussion

You must implement this method to support quick switching between Apple Watch devices in your iOS app. The session calls this method when there is no more pending data to deliver to your app and the previous session can be formally closed.

When this method is called, call the activateSession method again to initiate a session with the new Apple Watch, as shown in Listing 1. You can also perform any final cleanup tasks related to closing out the previous session.

Listing 1

Handling the deactivation of the session

- (void)sessionDidDeactivate:(WCSession *)session {
   // Begin the activation process for the new Apple Watch.
   [[WCSession defaultSession] activateSession];
}

See Also

Managing Session Activation

- session:activationDidCompleteWithState:error:

Called when the activation of a session finishes.

Required.

- sessionDidBecomeInactive:

Called when the session prepares to stop communicating with the current Apple Watch.

Required.