如何使用 Azure 通知中心向特定 APNS 通知令牌发送通知

How to send a notification to a specific APNS notification token using Azure Notification Hub

我目前正在使用以下代码,它使用可枚举标签参数中指定的标签发送到所有设备。但是,我想发送到具有特定通知令牌的设备。以下有效,但我找不到仅采用 APNS 令牌的重载?

NotificationService.Instance.Hub.SendAppleNativeNotificationAsync(jsonPayload, userTag);

要发送到特定句柄(在本例中为 APNS 令牌),您使用 'SendDirectNotificationAsync' 并且它不特定于 Apple、Windows 或 FCM,因为在幕后框架知道自从您指定平台的句柄的注册。签名如下:

 SendDirectNotificationAsync (Notification notification, 
    string deviceHandle, CancellationToken cancellationToken);