<!--
{
  "availability" : [
    "iOS: 27.0.0 -",
    "iPadOS: 27.0.0 -",
    "macCatalyst: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "MediaDevice",
  "identifier" : "/documentation/MediaDevice/MediaDeviceExtension/connectUsingPairingCode(_:to:session:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Media Device"
    ],
    "preciseIdentifier" : "s:11MediaDevice0aB9ExtensionP23connectUsingPairingCode_2to7sessionySSSg_AA0a6OutputB0VAA0aJ7SessionCtF"
  },
  "title" : "connectUsingPairingCode(_:to:session:)"
}
-->

# connectUsingPairingCode(_:to:session:)

Called after the user has input their authorization into a user interface.
Use the Security framework’s keychain to store any derived key material.

```
@MainActor func connectUsingPairingCode(_ pairingCode: String?, to device: MediaOutputDevice, session: MediaOutputSession)
```

## Parameters

`pairingCode`

The PIN code or password entered by the user. May be `nil` if the user canceled the pairing process.

`device`

The device that the pairing response is for.

`session`

The session associated with the pairing request.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)