Skip to content

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

@inkCrazy

Description

@inkCrazy

你的运行环境

  • 插件版本:
    "jcore-react-native": "^2.1.9",
    "jpush-react-native": "^3.0.9",
  • react-native 版本:
    "react": "18.2.0",
    "react-native": "0.72.4",

期望效果

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

实际效果

报错: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});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions