Skip to content

Commit 222ce5f

Browse files
Merge pull request #484 from jpush/dev
update docs
2 parents f1d6a2a + 2533a67 commit 222ce5f

File tree

1 file changed

+0
-37
lines changed

1 file changed

+0
-37
lines changed

documents/ios_usage.md

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -73,40 +73,3 @@ didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken {
7373
completionHandler();
7474
}
7575
```
76-
77-
然后在 js 代码里面通过如下回调获取通知
78-
79-
```
80-
var { NativeAppEventEmitter } = require('react-native');
81-
82-
var subscription = NativeAppEventEmitter.addListener(
83-
'ReceiveNotification',
84-
(notification) => console.log(notification)
85-
);
86-
...
87-
// 千万不要忘记忘记取消订阅, 通常在componentWillUnmount函数中实现。
88-
subscription.remove();
89-
```
90-
91-
在 jpush-react-native 1.2.9 开始提供 OpenNotification 事件。获取点击通知事件,需要获得该条推送需要在 js 代码加入如下监听代码:(注意这个事件只有在 iOS 10 之后才有)
92-
93-
```
94-
var subscription = NativeAppEventEmitter.addListener(
95-
'OpenNotification',
96-
(notification) => console.log(notification)
97-
);
98-
```
99-
100-
* JPush 提供应用内消息,用户可以发送应用内消息给应用,如果手机应用在前台就会收到这个消息,否则存为离线消息。我们可以通过如下代码获取这个应用内消息
101-
102-
```
103-
var { NativeAppEventEmitter } = require('react-native');
104-
105-
var subscription = NativeAppEventEmitter.addListener(
106-
'networkDidReceiveMessage',
107-
(message) => console.log(message)
108-
);
109-
...
110-
// 千万不要忘记忘记取消订阅, 通常在componentWillUnmount函数中实现。
111-
subscription.remove();
112-
```

0 commit comments

Comments
 (0)