且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

远程关闭 iOS 推送通知

更新时间:2022-06-05 01:48:37

通过使用 Parse 推送此有效负载,我还能够清除所有推送通知.我猜只要你提供 content-availablebadge,你应该能够做同样的事情.我不必在 AppDelegate 中编写任何其他代码,但我确实必须在项目目标 capabilities 中打开推送通知.

I was able to clear all of my push notifications as well by pushing this payload, using Parse. I'm guessing as long as you supply content-available and badge, you should be able to do the same. I didn't have to write any other code in the AppDelegate, but I did have to turn on push notifications in the projects target capabilities.

curl -X POST \
-H "X-Parse-Application-Id: xxxxxxxxxxx" \
-H "X-Parse-REST-API-Key: xxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
       "data": {
         "content-available": "1",
         "badge":"0",
         "sound":""
       },
       "where": {"something":"something_else"}
     }' \
https://api.parse.com/1/push