title: How to get the Push Notifications displayed in the Notification center
body: <p>All of these came from just one app I'm currently developing, let's call this app <strong>SampleApp</strong></p>
  
  <p>How do I get a list of these notifications from my Phone's Tray</p>
  
  <p><a href="https://i.stack.imgur.com/IVrrB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IVrrB.png" alt="enter image description here"></a></p>
  
  <p>Yes I do know that I may be able to get the notifications via this code</p>
  
  <pre><code>if #available(iOS 10.0, *) {           
      UNUserNotificationCenter.current().getPendingNotificationRequests { (requests) in
          print("here are the iOS 10 notifs \(requests)")
      }         
  } else {
      let requests = (UIApplication.shared.scheduledLocalNotifications ?? [])
      print("here are the NON iOS 10 notifs \(requests)")
  }
  </code></pre>
  
  <p>But the problem with this code is that I can only get notifications which <em>I created offline</em>, and not those coming from the <strong>Apple Push Notification Server (APNS)</strong></p>
  
  <p>By created offline I mean, scheduled <code>UILocalNotification</code>s, and since <strong>Push Notifications</strong> aren't <code>UILocalNotification</code>s I have no idea what to do</p>
  
  <p><strong>Some Questions You May ask</strong></p>
  
  <ol>
  <li><p>Are these notifications from my app? </p>
  
  <ul>
  <li>Yes</li>
  </ul></li>
  <li><p>Am I using the <code>didReceiveRemoteNotification</code> on the <code>AppDelegate</code>?</p>
  
  <ul>
  <li>Yes, but that's different.</li>
  </ul></li>
  <li><p>Does my remote notifications work/come from APNS</p>
  
  <ul>
  <li>Yes.</li>
  </ul></li>
  <li><p>What does my code for registering remote notifications look like?</p>
  
  <pre><code>if #available(iOS 10.0, *) {
      let authOptions: UNAuthorizationOptions = [.alert, .badge, .sound]
      let center = UNUserNotificationCenter.current()
      center.delegate = self
      center.requestAuthorization(options: authOptions, completionHandler: { (_, _) in })
  } else {
      let settings = UIUserNotificationSettings(types: [.alert, .badge, .sound], categories: nil)
      application.registerUserNotificationSettings(settings)
  }
  
  application.registerForRemoteNotifications()
  </code></pre></li>
  </ol>