UNNotificationActions отображается на iPhone, но не на Apple Watch - PullRequest
1 голос
/ 03 ноября 2019

Работа с локальными уведомлениями с настраиваемыми действиями. Уведомление отображается на моем iPhone и включает в себя все 3 пользовательских действия, назначенных категории.

Когда мой iPhone заблокирован, уведомление приходит на мои Apple Watch, но там нет пользовательских действий - только кнопка Отключить.

Есть идеи, что здесь происходит?

Вот пример кода

let actionLess = UNNotificationAction(identifier: "LESS",
                                              title: "Less",
                                              options: [.foreground])
let actionMore = UNNotificationAction(identifier: "MORE",
                                              title: "More",
                                              options: [.foreground])
let action90 = UNNotificationAction(identifier: "90",
                                            title: "90min",
                                            options: [.foreground])
let category = UNNotificationCategory(identifier: "SLEEP4B",
                                            actions: [actionLess, action90, actionMore],
                                            intentIdentifiers: [],
                                            options: .customDismissAction)
UNUserNotificationCenter.current().setNotificationCategories([category])


func userNotificationCenter(_ center: UNUserNotificationCenter,
                                willPresent notification: UNNotification,
                                withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void) {

        completionHandler([.alert, .sound, .badge])

}
...