我正在实施 FCM 推送通知。
当应用程序处于前台时,我会收到通知。
但我没有在后台收到通知。
在服务器端,我设置了 content-available => true
在 iOS 10 上,我应该实施任何其他方法还是从哪里获得后台通知?
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, willPresentNotification notification: UNNotification, withCompletionHandler completionHandler: (UNNotificationPresentationOptions) -> Void)
{
print("userNotificationCenter : Forground")
completionHandler([.Alert,.Sound,.Badge])
}
@available(iOS 10.0, *)
func userNotificationCenter(center: UNUserNotificationCenter, didReceiveNotificationResponse response: UNNotificationResponse, withCompletionHandler completionHandler: () -> Void)
{
//Code Todo After User presess notification
}
PHP 服务器有效负载代码:
$payloadFeild = array(
'registration_ids' => $gotoFcmUidVar,
'data' => array('MsgKey'=>json_encode($fcmMsgVar)),
'content_available' => true,
'priority' => 'high'
);