Why aren't iOS10 user notifications firing?
<p>I've taken this code directly from Apple's page: <a href="https://developer.apple.com/reference/usernotifications/unmutablenotificationcontent" rel="nofollow">https://developer.apple.com/reference/usernotifications/unmutablenotificationcontent</a>. I've place it in viewDidLoad(). <code>UserNotifications</code> has been imported.</p>

<p>It compiles, the app runs, breakpoints in the code are hit but no notification. I'm using Xcode 8 (not beta) and targeting iOS10.</p>

<p>Any idea what I'm doing wrong?</p>

<pre><code>let content = UNMutableNotificationContent()
content.title = "Hello!"
content.body = "Hello_message_body"
content.sound = UNNotificationSound.default()
// Deliver the notification in five seconds.
let trigger = UNTimeIntervalNotificationTrigger.init(timeInterval: 2, repeats: false)
let request = UNNotificationRequest.init(identifier: "2", content: content, trigger: trigger)

// 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.currentNotificationCenter()
center.addNotificationRequest(request)
</code></pre>