Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
inkCrazy opened this issue Aug 20, 2024 · 0 comments

Comments

@inkCrazy
Copy link

inkCrazy commented Aug 20, 2024

你的运行环境

  • 插件版本:
    "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});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant