Get data from payload when remote push notification arrive while my app is in background or closed
<p>I need to capture data from payload when recive a remote push notification, on IOS 9 i did this using the func:
didReceiveRemoteNotification
On IOS 10 using swift 3.0 i've implemented this 2 functions.</p>

<pre><code>@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, willPresent notification: UNNotification, withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -&gt; Void)
{
print("\(notification.request.content.userInfo)")

completionHandler([.alert, .badge, .sound])
}

@available(iOS 10.0, *)
func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -&gt; Void)
{
print("User Info = ",response.notification.request.content.userInfo)

completionHandler()
}
</code></pre>

<p>the second fuction only executes when the user touch the push </p>

<p>i need capture data when a push notification arrives while my app is in background or even closed.</p>

<p>Regards. 
greetings</p>