настроенное действие не появляется в push-уведомлении - PullRequest
0 голосов
/ 04 октября 2019

действие, когда я перемещаю уведомление влево, не отображается, как показано на рисунке, я могу получить доступ к действию только при нажатии кнопки просмотра Screen grab

Ссылка на вышеуказанный снимок экрана

if #available(iOS 10.0, *) {
            // For iOS 10 display notification (sent via APNS)
            UNUserNotificationCenter.current().delegate = self as! UNUserNotificationCenterDelegate
            let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
            UNUserNotificationCenter.current().requestAuthorization(
                options: authOptions,
                completionHandler: {_, _ in })

            // For iOS 10 data message (sent via FCM)
            Messaging.messaging().delegate = self
            Messaging.messaging().isAutoInitEnabled = true
        } else {


            let completeAction = UIMutableUserNotificationAction()
            completeAction.identifier = "COMPLETE_TODO" // the unique identifier for this action
            completeAction.title = "Complete" // title for the action button
            completeAction.activationMode = .background // UIUserNotificationActivationMode.Background - don't bring app to foreground
            completeAction.isAuthenticationRequired = false // don't require unlocking before performing action
            completeAction.isDestructive = true // display action in red

            let remindAction = UIMutableUserNotificationAction()
            remindAction.identifier = "REMIND"
            remindAction.title = "Remind in 30 minutes"
            remindAction.activationMode = .background
            remindAction.isDestructive = false

            let todoCategory = UIMutableUserNotificationCategory() // notification categories allow us to create groups of actions that we can associate with a notification
            todoCategory.identifier = "TODO_CATEGORY"
            todoCategory.setActions([remindAction, completeAction], for: .default) // UIUserNotificationActionContext.Default (4 actions max)
            todoCategory.setActions([completeAction, remindAction], for: .minimal) // UIUserNotificationA


            let settings: UIUserNotificationSettings =
                UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: Set([todoCategory]))

            application.registerUserNotificationSettings(settings)
        }
...