11[ ![ tag] ( https://img.shields.io/badge/tag-1.6.7-blue.svg )] ( https://github.com/jpush/jpush-react-native/releases )
22[ ![ QQ Group] ( https://img.shields.io/badge/QQ%20Group-553406342-red.svg )] ( )
3+
34# JPush React Native Plugin
45
56[ English Document] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/ReadMeEn.md )
67
78## NOTE:
8- - for latest RN, use latest
9- - for jpush-react-native > 1.4.4, require install [ jcore-react-native] ( https://github.com/jpush/jcore-react-native )
10- - 安装完 jcore 后,需要执行自动配置脚本,如果出错了,需要手动配置一下,[ 详细过程参考这篇文章] ( http://bbs.reactnative.cn/topic/3505/%E7%94%A8-jpush-react-native-%E6%8F%92%E4%BB%B6%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E6%8E%A8%E9%80%81%E5%8A%9F%E8%83%BD-android-%E7%AF%87 )
11- ## 安装
9+
10+ * for latest RN, use latest
11+ * for jpush-react-native > 1.4.4, require install [ jcore-react-native] ( https://github.com/jpush/jcore-react-native )
12+ * 安装完 jcore 后,需要执行自动配置脚本,如果出错了,需要手动配置一下,[ 详细过程参考这篇文章] ( http://bbs.reactnative.cn/topic/3505/%E7%94%A8-jpush-react-native-%E6%8F%92%E4%BB%B6%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90%E6%8E%A8%E9%80%81%E5%8A%9F%E8%83%BD-android-%E7%AF%87 )
13+ ## 安装
14+
1215```
1316npm install jpush-react-native --save
1417npm install jcore-react-native --save ## jpush-react-native 1.4.2 版本以后需要同时安装 jcore-react-native
15-
1618```
19+
1720##### (如果是原生应用集成 react-native)使用 CocoaPods 安装
1821
1922在 Podfile 中添加如下代码:
2023
2124```
2225pod 'JPushRN', :path => '../node_modules/jpush-react-native'
2326```
27+
2428终端执行如下指令:
2529
2630```
@@ -30,9 +34,11 @@ pod install
3034## 配置
3135
3236配置包括两个步骤,自动配置和手动操作。
37+
3338### 1.自动配置部分(以下命令均在你的 React Native Project 目录下运行,自动配置后仍需手动配置一部分)
3439
35- - 执行脚本
40+ * 执行脚本
41+
3642```
3743npm run configureJPush <yourAppKey> <yourModuleName>
3844//module name 指的是你 Android 项目中的模块名字(对 iOS 没有影响,不填写的话默认值为 app,会影响到查找 AndroidManifest 问题,
@@ -41,26 +47,34 @@ npm run configureJPush <yourAppKey> <yourModuleName>
4147npm run configureJPush d4ee2375846bc30fa51334f5 app
4248```
4349
44- - Link 项目
50+ * Link 项目
51+
4552```
4653//执行自动配置脚本后再执行 link 操作
4754react-native link
4855```
56+
4957自动配置操作会自动插入 Native 代码(iOS 中使用 Appdelegate.m 文件名,如果修改了该文件名需要手动插入[ 代码] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/iOS_Usage.md ) ),这个部分用户无需关系具体细节,如果实在想了解加入代码的细节可以查看如下链接
50- - [ iOS 自动配置后自动添加的代码] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/iOS_Usage.md )
5158
52- ### 2.手动操作部分(自动配置后,部分操作需要手动修改)
53- #### iOS 手动操作部分 (3个步骤)
54- - 在 iOS 工程中设置 TARGETS-> BUILD Phases -> LinkBinary with Libraries 找到 UserNotifications.framework 把 status 设为 optional
59+ * [ iOS 自动配置后自动添加的代码] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/iOS_Usage.md )
60+
61+ ### 2.手动操作部分(自动配置后,部分操作需要手动修改)
62+
63+ #### iOS 手动操作部分 (3 个步骤)
64+
65+ * 在 iOS 工程中设置 TARGETS-> BUILD Phases -> LinkBinary with Libraries 找到 UserNotifications.framework 把 status 设为 optional
66+
67+ * 在 iOS 工程中如果找不到头文件可能要在 TARGETS-> BUILD SETTINGS -> Search Paths -> Header Search Paths 添加如下路径
5568
56- - 在 iOS 工程中如果找不到头文件可能要在 TARGETS-> BUILD SETTINGS -> Search Paths -> Header Search Paths 添加如下路径
5769```
5870$(SRCROOT)/../node_modules/jpush-react-native/ios/RCTJPushModule
5971```
60- - 在 xcode8 之后需要点开推送选项: TARGETS -> Capabilities -> Push Notification 设为 on 状态
6172
62- #### Android 手动操作部分 (3个步骤)
63- - 修改 app 下的 build.gradle 配置:
73+ * 在 xcode8 之后需要点开推送选项: TARGETS -> Capabilities -> Push Notification 设为 on 状态
74+
75+ #### Android 手动操作部分 (3 个步骤)
76+
77+ * 修改 app 下的 build.gradle 配置:
6478
6579> your react native project/android/app/build.gradle
6680
@@ -86,29 +100,30 @@ dependencies {
86100
87101将此处的 yourApplicationId 替换为你的项目的包名;yourAppKey 替换成你在官网上申请的应用的 AppKey。
88102
89- - [ 检查添加的配置项] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/Check.md )
90-
91- - [ 加入 JPushPackage,有参数!] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/Android%20Usage.md )
103+ * [ 检查添加的配置项] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/Check.md )
92104
105+ * [ 加入 JPushPackage,有参数!] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/Android%20Usage.md )
93106
94107### API
95- ** Android v1.6.6 版本后新增 notifyJSDidLoad,请务必在接收事件之前调用此方法。**
96- - [ API] ( ./example/documents/APIs.md )
97108
98- ### 关于点击通知跳转到指定界面
99- - Android
109+ ** Android v1.6.6 版本后新增 notifyJSDidLoad,请务必在接收事件之前调用此方法。**
100110
101- v1.6.7 新增 API ` jumpToPushActivity ` ,使用参考 [ demo ] ( ./example/react-native-android/push_activity.js#L113 )
111+ * [ API ] ( ./example/documents/APIs.md )
102112
113+ ### 关于点击通知跳转到指定界面
103114
115+ * Android
104116
117+ v1.6.7 新增 API ` jumpToPushActivity ` ,使用参考 [ demo] ( ./example/react-native-android/push_activity.js#L113 )
105118
106119## [ 常见问题] ( ./example/documents/common_problems.md )
107120
108121### [ 关于更新 RN] ( https://github.com/jpush/jpush-react-native/blob/master/example/documents/Update%20React%20Native.md )
109122
110123---
124+
111125贡献者列表
112- - [ bang88] ( https://github.com/bang88 )
113- - [ pampang] ( https://github.com/pampang )
114- - [ huhuanming] ( https://github.com/huhuanming )
126+
127+ * [ bang88] ( https://github.com/bang88 )
128+ * [ pampang] ( https://github.com/pampang )
129+ * [ huhuanming] ( https://github.com/huhuanming )
0 commit comments