iOS 的 Firebase 云消息传递本地化参数?

Firebase Cloud Messaging localization arguments for iOS?

我正在尝试使用 FCM 为 iOS 编写本地化推送通知。我无法弄清楚消息的正确格式。这是我现在格式化它的方式:

async function sendLocationLostNotification(notificationToken: string, newOwner: string, locationName: string) {
    const message = {
        name: "Location Lost Notification",
        token: notificationToken,
        apns: {
            payload: {
                aps: {
                    alert: {
                        loc_key: "location-lost-notification-body",
                        loc_args: [newOwner, locationName]

                    },
                    sound: "default"
                }
            }
        }
    };

    return await admin.messaging().send(message)
}

这给了我以下错误:

src/index.ts:109:41 - error TS2345: Argument of type '{ name: string; token: string; apns: { payload: { aps: { alert: { loc_key: string; loc_args: string[]; }; sound: string; }; }; }; }' is not assignable to parameter of type 'Message'.
  Type '{ name: string; token: string; apns: { payload: { aps: { alert: { loc_key: string; loc_args: string[]; }; sound: string; }; }; }; }' is not assignable to type 'TokenMessage'.
    Types of property 'apns' are incompatible.
      Type '{ payload: { aps: { alert: { loc_key: string; loc_args: string[]; }; sound: string; }; }; }' is not assignable to type 'ApnsConfig'.
        Types of property 'payload' are incompatible.
          Type '{ aps: { alert: { loc_key: string; loc_args: string[]; }; sound: string; }; }' is not assignable to type 'ApnsPayload'.
            Types of property 'aps' are incompatible.
              Type '{ alert: { loc_key: string; loc_args: string[]; }; sound: string; }' is not assignable to type 'Aps'.
                Types of property 'alert' are incompatible.
                  Type '{ loc_key: string; loc_args: string[]; }' is not assignable to type 'string | ApsAlert | undefined'.
                    Type '{ loc_key: string; loc_args: string[]; }' has no properties in common with type 'ApsAlert'.

109     return await admin.messaging().send(message)

我读过 Apple's docs about the correct payload format which is referenced to from the Firebase API reference. Also seen 关于类似的问题,但 Jen Person 建议的格式给了我与我现在面临的相同的错误。我能够使其静音的唯一方法是将 titlebody 添加到警报对象,但这会覆盖 loc-keys。所以这些键似乎是强制性的。此外,我尝试过同时使用 body_loc_keytitle_loc_key,但没有成功。

这可能是什么问题?

原来ApsAlert根据these docs使用了locKeylocArgs