jpush / jpush-react-native

JPush's officially supported React Native plugin (Android & iOS). 极光推送官方支持的 React Native 插件(Android & iOS)。
http://docs.jiguang.cn
MIT License
1.35k stars 336 forks source link

clearNotificationById报错Value for nitificationId cannot be cast from String to Double #956

Open inkCrazy opened 1 month ago

inkCrazy commented 1 month ago

你的运行环境

处理消息完毕之后,把通知栏目对应的消息去掉

实际效果

报错:Value for nitificationId cannot be cast from String to Double

消息过来

重现步骤

 监听了addNotificationListener方法
    this.notificationListener = result => {
      console.log('notificationListener:' + JSON.stringify(result));
      console.log('notificationListener:', result);
      if (
        result &&
        result.extras &&
        result.notificationEventType === 'notificationArrived'
      ) {
        let extras = result.extras;
        switch (extras.type) {
          case 'sensitive':
            console.log('授权通知', extras);
            this.setState(
              {
                authInfo: {
                  ...extras,
                  isVisible_out: true,
                },
              },
              () => {
                // JPush.clearAllNotifications();
                console.log('JPush.clearNotificationById', result.messageID);
                //报错:Value for nitificationId cannot be cast from String to Double
                JPush.clearNotificationById({notificationId: result.messageID});
              },
            );
            break;
          default:
            break;
        }
      }
    };
    JPush.addNotificationListener(this.notificationListener);

Debug logs

包括 Android 或 iOS 的日志: //报错:Value for nitificationId cannot be cast from String to Double JPush.clearNotificationById({notificationId: result.messageID});