A delegate protocol that defines methods for receiving messages sent by a WCSession object.


@protocol WCSessionDelegate


Session objects are used to communicate between a WatchKit extension and the companion iOS app on a paired and active iPhone. When configuring your session object, you must specify a delegate object that implements this protocol. The session calls your delegate methods to deliver incoming data from the counterpart app and to manage session-related changes.

Most methods of this protocol are optional. You implement the methods you need to respond to the data transfer operations that your apps support. However, apps must implement the session:activationDidCompleteWithState:error: method, supporting asynchronous activation. On iOS, you must also implement the sessionDidBecomeInactive: and sessionDidDeactivate: methods, supporting multiple Apple Watches.

The WCSession object calls the methods of its delegate serially, so your method implementations do not need to be reentrant. Immediate messages can be sent only while both the WatchKit extension and iOS app are running. By contrast, context updates and file transfers can be initiated at any time and delivered in the background to the other device. All transfers are delivered in the order in which they were sent.

Supporting Communication with Multiple Apple Watches

An iPhone running iOS 9.3 or later may pair with more than one Apple Watch running watchOS 2.2 or later. Implement the following methods in your session delegate:

Use the activation-related methods to track the activation state of the session in your iOS app. With Auto Switch enabled on the user’s iPhone, the session automatically moves to the inactive state when the user puts on a different Apple Watch than the one that is currently active. (If Auto Switch is disabled, the user must manually select which watch is active.) While your iOS app is in the inactive state, the system finishes delivering any data that has been received before moving your app to the deactivated state. While inactive or deactivated, you cannot initiate any new transfers. When your iOS app reaches the deactivated state, call the session’s activateSession method again to connect to the new Apple Watch.

For more information about the flow of messages when a user switches from one Apple Watch to another, see WCSession.


Managing Session Activation

- session:activationDidCompleteWithState:error:

Called when the activation of a session finishes.


- sessionDidBecomeInactive:

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


- sessionDidDeactivate:

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


Managing State Changes

- sessionWatchStateDidChange:

Called when a feature is enabled or disabled.

- sessionReachabilityDidChange:

Called when the reachability of the counterpart session changes.

Receiving Context Data

- session:didReceiveApplicationContext:

Called when the session receives context data from the counterpart.

Receiving Immediate Messages

- session:didReceiveMessage:

Called when an immediate message arrives.

- session:didReceiveMessage:replyHandler:

Called when an immediate message arrives and requires a response.

- session:didReceiveMessageData:

Called when an immediate data message arrives.

- session:didReceiveMessageData:replyHandler:

Called when an immediate data message arrives and requires a response.

Managing Data Dictionary Transfers

- session:didReceiveUserInfo:

Called when a data dictionary is received successfully.

- session:didFinishUserInfoTransfer:error:

Called when a data transfer operation finished successfully or because of an error.

Managing File Transfers

- session:didReceiveFile:

Called when a file is received successfully.

- session:didFinishFileTransfer:error:

Called when a file transfer finished successfully or because of an error.


Inherits From

See Also

First Steps


The object that initiates communication between a WatchKit extension and its companion iOS app.