Agregar notificación local en iOS 10 - Swift 3

Así que he estado tratando de agregar una notificación al nuevo UNUserNotificationCenter, pero parece que no lo consigo.

Mi controlador de vista tiene una acción:

@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
    }
}

Y tengo unNotification Content Extension en el proyecto también, pero no parece activarse en absoluto, ¿alguna idea de lo que me estoy perdiendo? Estoy probando el ejemplo de la documentación del usuario, pero no me dice mucho más o me lo he perdido.

Aquí:https://developer.apple.com/reference/usernotifications/unmutablenotificationcontent

También:https://developer.apple.com/reference/usernotificationsui https://developer.apple.com/reference/usernotifications

Editar:

Así que poner la aplicación en segundo plano hizo el truco.

Respuestas a la pregunta(5)

Su respuesta a la pregunta