使用 Cloud Functions 播放自定义通知声音 - iOS

Playing custom notification sound using Cloud Functions - iOS

我使用 Cloud FunctionsGoogleCloudMessaging 以这种方式向我的客户端应用程序发送通知:

const notificationContent = {
          notification: {
            title: `${senderName} has sent you a message`,
            body: `${messageString}`,
            icon: "default",
            sound: "customNotificationSound",
          },
        };
        return admin.messaging()
            .sendToDevice(notifToken, notificationContent)
            .then((result) =>{
              console.log("write done correctly");
            });

我想使用自定义通知声音而不是默认声音;所以我在网上遵循了一些指南,例如 this, this and this,但他们似乎没有回答我的问题。

既然是从云功能发送推送通知,我还需要在客户端Main Bundle中加载声音文件吗(我试过了,实际上它似乎不起作用)。

还是必须上传到其他地方?

P.s。声音文件的扩展名也是 .wav,所以应该没有问题。

我解决了这个问题,答案是肯定的,你仍然需要在你的 main bundle 中上传 music file 即使你正在从云功能发送推送通知