Вопрос по пуш уведомлениям

swift
swift4
ios

#1

Прошу помощи, есть приложение, нужно реализовать отработку функции и выведение результата в uilabel, на данный момент есть код вначале AppDelegate

    >  UNUserNotificationCenter.current().requestAuthorization(options:[.alert, .sound, .badge]) {
        (granted, error) in
        print(error as Any)
    }
    let choiceA = UNNotificationAction(identifier: "showVersion", title: "Показать версию iOS", options: [.foreground])
    let choiceB = UNNotificationAction(identifier: "showBattery", title: "Показать заряд", options: [.foreground])
    let choiceC = UNNotificationAction(identifier: "showModel", title: "Показать модель", options: [.foreground])
    let systemCategory = UNNotificationCategory(identifier: "systemCategory", actions:[choiceA, choiceB, choiceC], intentIdentifiers: [], options: [])
    UNUserNotificationCenter.current().setNotificationCategories([systemCategory])
    
    
    
    return true
}

и внизу AppDelegate сами if и функции которые они должны выполнять по клику по кнопке в уведомлении, в нашем случае это отображение на ViewController версии iOS

extension AppDelegate: UNUserNotificationCenterDelegate {

func userNotificationCenter( _ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {

let storyboard = UIStoryboard(name: “Main”, bundle: nil )

guard let viewController = storyboard.instantiateViewController(withIdentifier: “MainView”) as ? ViewController else { return }

if response.actionIdentifier == “showVersion” {

        viewController.testVersion.text = UIDevice.current.systemVersion

    }

else {viewController.name = “ttttt”}

}

}

Уведомления отправляю через пушер, через APNs, сейчас уведомления приходят, экшны там есть, но если нажимаешь на первый запускается приложение но как labelз был так и остается, функция никак не хочет отрабатывать. Не могу разобраться почему.