Channels for the Apple SDK

Access and manage channel IDs, listen for channel creation, and configure the channel capture tool.

Each device/app install will generate a unique identifier known as the Channel ID. Once a Channel ID is created, it will persist in the application until the app is reinstalled, or has its internal data is cleared.

If AirshipMessageCenter is installed, the SDK will attempt to restore the Channel ID across app reinstalls.

For information about finding Channel IDs, using the Channel Capture tool, and other methods to access Channel IDs, see Finding Channel IDs.

Accessing the Airship Channel ID

Apps can access the Channel ID directly through the SDK.

Accessing the channel ID

let channelID = Airship.channel.identifier
NSString *channelID = UAirship.channel.identifier;

The Channel ID is asynchronously created, so it may not be available right away on the first run. Changes to Channel data will automatically be batched and applied when the Channel is created, so there is no need to wait for the Channel to be available before modifying any data.

Applications that need to access the Channel ID can use a listener to be notified when it is available.

Listening for the Channel ID

Using identifierUpdates (AsyncStream):

Task {
    for await channelID in Airship.channel.identifierUpdates {
        print("Channel ID: \(channelID)")
    }
}

Using NotificationCenter:

NotificationCenter.default.addObserver(
    self,
    selector: #selector(refreshView),
    name: AirshipNotifications.ChannelCreated.name,
    object: nil
)

Using NotificationCenter:

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(refreshView) name:UAirshipNotificationChannelCreated.name object:nil];

Channel Capture tool

The Channel Capture tool is a feature built into the SDK that helps users find their Channel ID. For detailed information about how it works and how to use it, see Finding Channel IDs.

The Channel Capture tool can be disabled through the Airship Config options passed to takeOff during SDK initialization. For information about setting up the Airship SDK and configuring AirshipConfig, see iOS SDK Setup.

Disabling Channel Capture tool

config.isChannelCaptureEnabled = false
config.isChannelCaptureEnabled = NO;

Delaying channel creation

Airship creates the channel if at least one feature is enabled in the Privacy Manager. To delay channel creation, use the Privacy Manager to disable all features during takeOff.

For more information about Privacy Manager, see Privacy Manager.