<!--
{
  "availability" : [
    "iOS: 26.3.0 -",
    "iPadOS: 26.3.0 -",
    "macCatalyst: 26.3.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreTelephony",
  "identifier" : "/documentation/CoreTelephony/CTSlicingManager/activatePreferredSliceForCategory(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Core Telephony"
    ],
    "preciseIdentifier" : "s:13CoreTelephony16CTSlicingManagerC33activatePreferredSliceForCategoryyyAC03AppI0OYaKF"
  },
  "title" : "activatePreferredSliceForCategory(_:)"
}
-->

# activatePreferredSliceForCategory(_:)

Activates a preferred network slice for new connections.

```
final func activatePreferredSliceForCategory(_ appCategory: CTSlicingManager.AppCategory) async throws
```

## Parameters

`appCategory`

The [`CTSlicingManager.AppCategory`](/documentation/CoreTelephony/CTSlicingManager/AppCategory) to activate. Available categories include:

- `communication`: An app category for communication apps like messaging and voice calls.
- `gaming`: An app category for gaming apps that require low latency and high performance.
- `streaming`: An app category for streaming apps that require high bandwidth and consistent throughput.

## Discussion

Call this method before establishing network connections to route your app’s traffic through a specific network slice. After calling this method, new network connections that your app establishes use the specified slice category.

The array that [`availableSliceAppCategories`](/documentation/CoreTelephony/CTSlicingManager/availableSliceAppCategories) returns must include the specified category for activation to succeed.

> Important: This method only affects connections that the system creates after calling it. Existing active connections continue to use their current routing until the system closes them.

```swift
do {
    // Activate the gaming slice before starting a multiplayer session.
    try await CTSlicingManager.shared.activatePreferredSliceForCategory(.gaming)

    // Establish network connections for gaming traffic.
    // New connections route through the gaming network slice.
    // Existing connections remain on their current routing.
} catch POSIXError.ENOTSUP {
    print("Network slicing isn't currently available.")
} catch {
    print("Failed to activate slice: \(error)")
}
```

> Throws:
> 
> - `POSIXError.ENOTSUP` if network slicing is not currently available.
> - `POSIXError.EINVAL` if an invalid parameter or system error occurs.

---

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)