首先,官方文档,这是你必看的。虽然看了之后你也会报错...

然后记录下我的集成步骤:(按我的步骤来应该不会有错)

1. 插件安装(不要用npm install,不然你会遇到很多错误,会让你蛋疼得一逼)

yarn add jpush-react-native --save
yarn add jcore-react-native --save
2.导入极光的库到xcode(检查下库是否导入xcode)
react-native link
3.自动配置(在xcode中自行添加代码,并且配置依赖库)
yarn run configureJPush d4ee2375846bc30fa51334f5(这是你的appkey,此处官方事例key) app(app名字,ios可不添) 
4.进去看代码,官方给的代码对照下,在对应位置把你的appkey和相关配置配置好
[JPUSHService setupWithOption:launchOptions appKey:appKey //极光Key
                        channel:channel apsForProduction:false]; //false是开发环境,true表示发布环境
5.添加js代码
将下面代码放在第一个Component里面
  var { NativeAppEventEmitter } = require('react-native');
  //生命周期函数
  componentDidMount(){
  NativeAppEventEmitter.addListener(
    'receiveNotification',  //这里天坑,官方文档中写的是ReceiveNotification,实际自动集成的代码里面开头是小写,真有种骂娘的冲动,搞了一下午
    (message) => {
    Alert.alert('推送来了')
  })
  }
  componentWillUnmount() {
    NativeAppEventEmitter.removeAllListeners();
  }
最后说一下看通知名称的位置:
 
填坑一天半,记录在案。
补充一点:记得申请推送证书,并且xcode中记得打开通知。
这里再次集成的时候又踩了坑,需要在注册前设置通知类型,获取通知权限,代码如下

 

  if ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0) {

    JPUSHRegisterEntity * entity = [[JPUSHRegisterEntity alloc] init];

    entity.types = UNAuthorizationOptionAlert|UNAuthorizationOptionBadge|UNAuthorizationOptionSound;

    [JPUSHService registerForRemoteNotificationConfig:entity delegate:self];

  }

  else if ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0) {

    //可以添加自定义categories

    [JPUSHService registerForRemoteNotificationTypes:(UIUserNotificationTypeBadge |

                                                      UIUserNotificationTypeSound |

                                                      UIUserNotificationTypeAlert)

                                          categories:nil];

  }

  else {

    //categories 必须为nil

    [JPUSHService registerForRemoteNotificationTypes:(UIRemoteNotificationTypeBadge |

                                                      UIRemoteNotificationTypeSound |

                                                      UIRemoteNotificationTypeAlert)

                                          categories:nil];

  }

  

  [JPUSHService setupWithOption:launchOptions appKey:@"极光ID"

                        channel:nil apsForProduction:false];