[英]Service Extension not called for Parse Cloud Code push notification
我正在嘗試使用 Cloud Code 從 Parse Server 4.2.0 發送推送通知。
我從 Firebase Cloud Messaging 切換並實現了一個服務擴展,該擴展根據通知有效負載更改了通知標題和正文。
切換到 Parse Push 后,我意識到不再調用服務擴展。
檢查文檔后,我嘗試添加mutable-content
標志,這使我的應用程序在調用 Cloud function 時崩潰。
所有四個被注釋掉的標志都會導致 Parse 服務器錯誤:
Fatal error: Error calling cloud function: ParseError code=141 error=Invalid function: "pushsample"
當我將它們注釋掉時,function 工作,我在我的測試設備上收到推送通知。
如何正確設置mutable-content
標志,以便在將通知顯示給用戶之前對其進行修改?
我的 Parse 后端是 Back4App,我像這樣初始化 Parse 服務器(傳遞的變量包含必要的信息作為字符串:
ParseSwift.initialize(applicationId: applicationId, clientKey: clientKey, serverURL: serverURL)
這是我的雲 Function:
Parse.Cloud.define('pushsample', async () => {
Parse.Push.send({
channels: ["channelForTesting"],
data: {
alert: 'from CloudCode',
title: 'Hello',
// content-available: 1,
// push_type: alert,
// priority: 10,
// mutable-content: 1,
}
}, { useMasterKey: true });
return 'pushsample called successfully';
});
感謝 Davi,這是一個錯字。 使用'mutable-content'
解決了這個問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.