<!--
{
  "availability" : [
    "iOS: 9.0.0 -",
    "iPadOS: 9.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.10.0 -",
    "tvOS: 11.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 4.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CryptoTokenKit",
  "identifier" : "/documentation/CryptoTokenKit/TKSmartCard/beginSession(reply:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "CryptoTokenKit"
    ],
    "preciseIdentifier" : "c:objc(cs)TKSmartCard(im)beginSessionWithReply:"
  },
  "title" : "beginSession(reply:)"
}
-->

# beginSession(reply:)

Begins a session with the Smart Card.

```
func beginSession(reply: @escaping @Sendable (Bool, (any Error)?) -> Void)
```

## Parameters

`reply`

- success: Whether the session could be established successfully.
- error: Contains information about the error preventing the transaction from being established.

    The     `NSError`     object is created in the [`TKErrorDomain`](/documentation/CryptoTokenKit/TKErrorDomain)     domain with a code in the [`TKError.Code`](/documentation/CryptoTokenKit/TKError/Code)     enumeration.

## Discussion

This method will fail if there is already an existing session for the Smart Card.

Calls to this method must be balanced with calls to [`endSession()`](/documentation/CryptoTokenKit/TKSmartCard/endSession()).

---

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)