【发布时间】:2020-06-13 19:32:44
【问题描述】:
我正在尝试使用 iOS 应用程序在 Parse-Server (Heroku) 上使用推送通知。
此时我可以通过运行以下命令在我的 iOS 应用中收到通知:
curl -X POST \
-H "X-Parse-Application-Id: 12345678ABCDEFstuvwxyz" \
-H "X-Parse-Master-Key: ABCDEF12345678stuvwxyz" \
-H "Content-Type: application/json" \
-d '{
"where": {
"deviceType": {
"$in": ["ios"]
}
},
"data": {
"aps": {
"alert": {},
"content-available": 1
},
"title": "The Shining",
"alert": {},
"content-available": 1
}
}'\ https://myapp.herokuapp.com/parse/push
但现在我必须从云代码发送推送通知,即从 Parse.Cloud.afterSave 函数。
这是我尝试过的,遵循我在网上找到的一些示例代码,但它不起作用:
Parse.Cloud.afterSave("Item_List", (request) => {
Parse.Push.send({
??????
data: {"alert": "NOTIFICATION-FOR-USERS"},
}, { success: function() {
console.log("#### PUSH OK");
}, error: function(error) {
console.log("#### PUSH ERROR" + error.message);
}, useMasterKey: true});
});
获得我想要的东西的正确方法是什么?
【问题讨论】:
标签: ios push-notification apple-push-notifications parse-server heroku-api