TechnologiesNetworking & Connectivity

WatchConnectivity

iOSmacOStvOSwatchOSvisionOS

WatchConnectivity provides two-way communication between a paired iPhone app and its companion Apple Watch app. You activate a WCSession and assign a WCSessionDelegate to observe the session's WCSessionActivationState and to receive incoming data, then send live messages, queue background user-info updates through WCSessionUserInfoTransfer, and move files between devices using WCSessionFileTransfer and WCSessionFile. Errors surface as WCError, letting you handle failed transfers and unreachable counterparts.

Essentials 3

Establish and observe the communication session that connects a paired iPhone and Apple Watch app.

  • Cl
    WCSessioniOS 9.0+
    -------------------------------- WCSession --------------------------------
  • Pr
    WCSessionDelegate
    ----------------------------- WCSessionDelegate -----------------------------
  • En
    WCSessionActivationStateiOS 9.3+
    Constants that indicate whether a session is inactive, activated, or not yet activated.

Transferring Files 2

Move files between the paired devices and track each transfer in progress.

  • Cl
    WCSessionFileTransferiOS 9.0+
    Used to track a file being transferred.
  • Cl
    WCSessionFileiOS 9.0+
    Contains file information, such as the file's location and optional user info

Transferring User Info 1

Queue background dictionaries that are delivered to the counterpart app even when it isn't running.

  • Cl
    WCSessionUserInfoTransferiOS 9.0+
    Used to track a user info dictionary being transferred.

Handling Errors 1

Identify and respond to failures that occur during communication or transfers.

  • St
    WCErroriOS 9.0+
    A structure that describes errors arising from session activation, message delivery, or transfer failures.
← Networking & Connectivity