jpush / jpush/jpush-react-native

jpush-react-native@2.5.10 iOS能收到推送通知,但无法触发JS事件回调

Open
#683 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.4k
Forks
348
PR merge metrics
No merged PRs in 30d

Description

运行环境

  • 插件版本:
    "jcore-react-native": "^1.3.7",
    "jpush-react-native": "^2.5.10",
  • react-native 版本:0.59.8
  • xcode 11
  • iOS 12 & iOS 13

期望效果

实际效果

iOS能正常收到推送通知,前台能弹出通知,但无法触发JS事件回调,DevTools控制台无输出。
自定义消息能正常接收,并正确触发JS回调,DevTools控制台有console.log()输出。

iOS 12 & iOS 13下
无论APP处于前台运行、后台或杀死进程,都能正常弹出推送通知。
但都无法触发addNotificationListener回调。

js监听代码如下:

JPush.addConnectEventListener((result) => {
    console.log(`connectListener: ${JSON.stringify(result)}`)
})
JPush.addNotificationListener((result) => {
    console.log(`notificationListener: ${JSON.stringify(result)}`)
})
JPush.addCustomMessagegListener((result) => {
    console.log(`customMessageListener: ${JSON.stringify(result)}`)
})

PS: Android接入正常

重现步骤

按照最新的样例配置
https://github.com/jpush/jpush-react-native/blob/master/example/ios/example/AppDelegate.m

Debug logs

包括 Android 或 iOS 的日志:

debug日志正常,正确连接APNS,正确获取 deviceToken

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the iOS integration in example/ios/example/AppDelegate.m and compare the addNotificationListener path with the working addCustomMessagegListener path. Reproduce on the listed React Native, plugin, Xcode, and iOS versions; done means iOS notification pushes trigger the JavaScript notification callback in foreground, background, and terminated states.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react-native
Domain
mobile-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.