这里是我已经习惯了接收推送通知的代码时,应用前景iOS版雨燕接收推送通知当应用程序在前台
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, willPresentNotification notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void)
{
completionHandler([UNNotificationPresentationOptions.Alert,UNNotificationPresentationOptions.Sound,UNNotificationPresentationOptions.Badge])
}
但我的问题是,我的通知包含[NSObject的:AnyObject]值。如何收到这样的背景通知
是否要通过通知对象访问用户信息? – Darshana
@iOS_devloper是的,先生 –
我使用“notification.request.content.userInfo”来获得数据。你可以用上面的方法打印这个。 – Amanpreet