title: Add Local Notification in iOS 10 - Swift 3
body: <p>So I been trying to add a notification to the new UNUserNotificationCenter, but I don't seem to get it.</p>
  
  <p>My view controller has an action:</p>
  
  <pre><code>@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
      }
  }
  </code></pre>
  
  <p>And I have a <code>Notification Content Extension</code> in the project as well, but it does not seem to be triggered at all, any ideas what I'm missing? I'm trying the example from the user documentation, but it's not telling me much more or I have missed it.</p>
  
  <p>Here: <a href="https://developer.apple.com/reference/usernotifications/unmutablenotificationcontent" rel="nofollow noreferrer">https://developer.apple.com/reference/usernotifications/unmutablenotificationcontent</a></p>
  
  <p>Also:
  <a href="https://developer.apple.com/reference/usernotificationsui" rel="nofollow noreferrer">https://developer.apple.com/reference/usernotificationsui</a>
  <a href="https://developer.apple.com/reference/usernotifications" rel="nofollow noreferrer">https://developer.apple.com/reference/usernotifications</a></p>
  
  <p>Edit:</p>
  
  <p>So putting the app in the background did the trick.</p>