jpush / jpush-phonegap-plugin

JPush's officially supported PhoneGap/Cordova plugin (Android & iOS). 极光推送官方支持的 PhoneGap/Cordova 插件(Android & iOS)。
https://docs.jiguang.cn
MIT License
925 stars 350 forks source link

IOS无法接收自定义消息 #375

Closed OSpoon closed 5 years ago

OSpoon commented 5 years ago

WARNING: 如果不按照这个表格,我们将无法帮助你,并将忽略你的问题。

你的运行环境

期望效果

IOS正常接收自定义消息

实际效果

IOS无法正常接收自定义消息,同时推送的Android正常,推送通知双平台均正常

重现步骤

  1. 在官网推送页面进行自定义消息推送
  2. 在官网推送页面进行通知推送

背景

排除节点取值问题,执行在回调中执行alert(event)查看全部内容,未提示信息(监听应该未执行)

Debug logs

huangminlinux commented 5 years ago

具体调用了哪个接口? 接收推送事件是否成功?

OSpoon commented 5 years ago

地址:https://github.com/jpush/jpush-phonegap-plugin/blob/master/doc/Common_detail_api.md#event---jpushreceivemessage 方法:event - jpush.receiveMessage

// 获取自定义消息推送内容
document.addEventListener("jpush.receiveMessage", (event)=>{
   window.alert(JSON.stringify(event))       
}, false)

ios alert不提示 android alert 提示

huangminlinux commented 5 years ago

如果没有使用 bable 这种转换工具不用用箭头函数。 换成

document.addEventListener("jpush.receiveMessage", function (event) {
   window.alert(JSON.stringify(event))       
}, false)