Adicionar notificação local no iOS 10 - Swift 3

Então, eu estava tentando adicionar uma notificação ao novo UNUserNotificationCenter, mas não a recebi.

Meu controlador de exibição tem uma ação:

@IBAction func sendPressed(_ sender: AnyObject) {
    let content = UNMutableNotificationContent()

    content.title = "Hello"
    content.body = "What up?"
    content.sound = UNNotificationSound.default()

    // Deliver the notification in five seconds.
    let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 5, repeats: false)
    let request = UNNotificationRequest.init(identifier: "FiveSecond", content: content, trigger: trigger)

    // Schedule the notification.
    let center = UNUserNotificationCenter.current()
    center.add(request) { (error) in
        print(error)
    }
    print("should have been added")
}

override func viewDidAppear(_ animated: Bool) {
    super.viewDidAppear(animated)

    let center = UNUserNotificationCenter.current()
    center.requestAuthorization([.alert, .sound]) { (granted, error) in
    }
}

E eu tenho umNotification Content Extension no projeto também, mas não parece ter sido acionado, alguma idéia do que estou perdendo? Estou tentando o exemplo na documentação do usuário, mas não está me dizendo muito mais ou perdi.

Aqui:https://developer.apple.com/reference/usernotifications/unmutablenotificationcontent

Além disso:https://developer.apple.com/reference/usernotificationsui https://developer.apple.com/reference/usernotifications

Editar:

Então, colocar o aplicativo em segundo plano fez o truque.

questionAnswers(5)

yourAnswerToTheQuestion