---
updatedAt: 2026-07-07T17:07:22.000Z
---

# ConnectPush

The push notification interface for the Connect iOS SDK. Access via `try ConnectSDK.shared.push`.

**Platform:** iOS 15.1+
**Language:** Swift only (push notifications are not supported in Objective-C apps)
**Isolation:** `@MainActor`
**Declared in:** `ConnectSDK`

<Callout icon="📘" theme="info">
  ### Note

  `ConnectSDK.shared.push` throws `ConnectError.pushNotEnabled` if push was not configured at `enable()` time. Always pass a `ConnectPushConfig` (`.automatic`, `.manual`, or one with an App Group identifier) when calling `enable()`.
</Callout>

***

# Getting the push interface

```swift
let push = try ConnectSDK.shared.push
```

***

# Push configuration

Configure push at SDK initialization by passing a `ConnectPushConfig` to `enable(with:)`. Two modes are available:

| Mode         | Who registers for APNs? | Who forwards the device token?        | Use when                                                            |
| ------------ | ----------------------- | ------------------------------------- | ------------------------------------------------------------------- |
| `.automatic` | SDK                     | SDK                                   | You want the Connect SDK to manage APNs registration end-to-end.    |
| `.manual`    | Your app                | Your app (via `didRegisterWithToken`) | You already manage APNs registration or need custom token handling. |

```swift
public struct ConnectPushConfig: Sendable {
    public let mode: Mode
    public let appGroupIdentifier: String?

    // Convenience constants
    public static let off: ConnectPushConfig
    public static let automatic: ConnectPushConfig
    public static let manual: ConnectPushConfig
}
```

<Tabs>
  <Tab title="Automatic mode">

The SDK manages APNs registration end-to-end. For basic push support:

```swift
ConnectSDK.shared.enable(
    with: ConnectConfig(
        appKey: "YOUR_APP_KEY",
        postURL: "https://collector.example.com/collectorPost",
        push: .automatic
    )
)
```

To enable push delivery tracking and rich media from a Notification Service Extension, provide an App Group identifier:

```swift
ConnectSDK.shared.enable(
    with: ConnectConfig(
        appKey: "YOUR_APP_KEY",
        postURL: "https://collector.example.com/collectorPost",
        push: ConnectPushConfig(mode: .automatic, appGroupIdentifier: "group.com.example.YourApp")
    )
)
```

  </Tab>
  <Tab title="Manual mode">

Use manual mode when your app handles APNs registration itself. You are responsible for requesting device token registration and forwarding the result to the Connect SDK.

```swift
ConnectSDK.shared.enable(
    with: ConnectConfig(
        appKey: "YOUR_APP_KEY",
        postURL: "https://collector.example.com/collectorPost",
        push: ConnectPushConfig(mode: .manual, appGroupIdentifier: "group.com.example.YourApp")
    )
)
```

After APNs registration succeeds, forward the device token:

```swift
func application(_ application: UIApplication,
                 didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data) {
    try? ConnectSDK.shared.push.didRegisterWithToken(deviceToken)
}
```

> 📘 Note
>
> Calling `didRegisterWithToken` in `.automatic` mode throws `ConnectError.pushModeNotManual`. This method is only valid in manual mode.

  </Tab>
</Tabs>

***

# Status

| Property | Type                | Description                                          |
| -------- | ------------------- | ---------------------------------------------------- |
| `config` | `ConnectPushConfig` | The push configuration used at `enable(with:)` time. |

***

# Permission request

Use `requestAuthorization(options:)` to prompt the user for push notification permission directly through the SDK, without calling `UNUserNotificationCenter` yourself.

## ConnectPushAuthorizationOptions

`requestAuthorization(options:)` accepts a `ConnectPushAuthorizationOptions` value, which mirrors `UNAuthorizationOptions`. The commonly used options are:

| Option         | Description                                                                                                                                                              |
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `.alert`       | Display notifications in the notification center and as banners.                                                                                                         |
| `.badge`       | Update the app icon badge.                                                                                                                                               |
| `.sound`       | Play a sound when a notification is delivered.                                                                                                                           |
| `.provisional` | Send notifications without prompting the user first. Notifications are delivered quietly to the notification center — the user can then choose to keep or turn them off. |

The default is `[.alert, .badge, .sound]`.

## Request permission

```swift
let push = try ConnectSDK.shared.push
let (granted, error) = await push.requestAuthorization()

if granted {
    // User granted permission
} else if let error {
    // Permission denied or error
}
```

To request a non-default set of options:

```swift
let (granted, error) = await push.requestAuthorization(options: [.alert, .sound])
```

<Callout icon="📘" theme="info">
  ### Note

  `requestAuthorization(options:)` is available from Connect iOS SDK 2.1.15 (July 2026).
</Callout>

## Check current permission state

Use `getCurrentAuthorization()` to query the current authorization state without prompting the user.

```swift
let status = await push.getCurrentAuthorization()
// true  = granted, provisional, or ephemeral
// false = denied
// nil   = not yet determined
```

<Callout icon="📘" theme="info">
  ### Note

  `getCurrentAuthorization()` is available from Connect iOS SDK 2.1.15 (July 2026).
</Callout>

## Forward the result manually

If your app manages its own `UNUserNotificationCenter` authorization flow, forward the result to the SDK using `didReceiveAuthorization(granted:error:)` instead of calling `requestAuthorization(options:)`.

| Method                                          | Isolation     | Description                                                                   |
| ----------------------------------------------- | ------------- | ----------------------------------------------------------------------------- |
| `didReceiveAuthorization(granted:error:)`       | `nonisolated` | Notifies the SDK of the push permission result. Safe to call from any thread. |
| `didReceiveAuthorization(granted:error:) async` | `@MainActor`  | Async variant with ordering guarantee.                                        |

```swift
UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in
    Task { @MainActor in
        try? ConnectSDK.shared.push.didReceiveAuthorization(granted: granted, error: error)
    }
}
```

<Callout icon="📘" theme="info">
  ### Note

  `ConnectSDK.shared.push` is `@MainActor`-isolated. In Swift 6, accessing it from the non-isolated `requestAuthorization` completion handler requires a `Task { @MainActor in }` wrapper to satisfy strict concurrency checking.
</Callout>

***

# Token registration

| Method                                 | Isolation     | Description                                                                   |
| -------------------------------------- | ------------- | ----------------------------------------------------------------------------- |
| `didFailToRegisterWithError(_:)`       | `nonisolated` | Notifies the SDK that APNs registration failed. Safe to call from any thread. |
| `didFailToRegisterWithError(_:) async` | `@MainActor`  | Async variant with ordering guarantee.                                        |

***

# Category registration

| Method                             | Description                                                                                                                                                         |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `registerNotificationCategories()` | Re-registers Acoustic notification categories with `UNUserNotificationCenter`. Call this if your app replaces the notification categories after SDK initialization. |

<br />