Ionic:通过 firebase 从设备向设备发送推送通知:从 iOS 发送不起作用

Ionic: Send Push Notifications via firebase from device to device : Sending doesn't work from iOS

使用此代码在设备之间发送推送通知可以正常工作,但只能在 Android 和浏览器中使用。

出于某种原因,这在 iOS 上不起作用,无论我使用 postData 对象还是字符串化有效负载。有什么想法吗?

import { HttpClient } from '@angular/common/http';

public sendPushNotificationToToken(token: string, pnServerKey: string, message: string, userId: number): Observable<any> {

    const firebaseUrl = "https://fcm.googleapis.com/fcm/send";

    const httpOptions = {
      headers: new HttpHeaders({
        'Content-Type': 'application/json',
        'Authorization': 'key=' + pnServerKey
      })
    };

    const postData = {
      'to': token,
      'priority':'normal',
      'notification': {
        'title': message,
        'message': message,
        'userId': userId
      },
    };

    return this.http.post(firebaseUrl, postData, httpOptions);

解决这个问题的唯一方法是使用“@ionic-native/http/ngx”而不是“@angular/common/http”。仍然不明白为什么 google 服务器拒绝接受我的负载。