给 iOS 应用添加推送功能是一件比较麻烦的事情,本篇文章收集了集成 jpush-react-native 的常见问题,目的是为了帮助用户更好地排查问题node
调用 JPushModule.setBadge 方法 若是设为 0,则表示状况角标react
JPushModule.setBadge(5, (badgeNumber) => { console.log(badgeNumber) });
// iOS 10 Support - (void)jpushNotificationCenter:(UNUserNotificationCenter *)center willPresentNotification:(UNNotification *)notification withCompletionHandler:(void (^)(NSInteger))completionHandler { // Required NSDictionary * userInfo = notification.request.content.userInfo; if([notification.request.trigger isKindOfClass:[UNPushNotificationTrigger class]]) { [JPUSHService handleRemoteNotification:userInfo]; [[NSNotificationCenter defaultCenter] postNotificationName:kJPFDidReceiveRemoteNotification object:userInfo]; } completionHandler(UNNotificationPresentationOptionAlert); // 须要执行这个方法,选择是否提醒用户,有Badge、Sound、Alert三种类型能够选择设置 }
$(SRCROOT)/../node_modules/jpush-react-native/ios/RCTJPushModule/RCTJPushModule
RN 在 0.40.0 以后 不会自动加入这个路径了,要手动加一下ios
JPush SDK 在 3.0.0 及之后版本再也不支持 i386 的模拟器了血药在 iphone 5s 以上版本中测试react-native
做者:HuminiOS - 极光
原文:集成 jpush-react-native 常见问题汇总 (iOS 篇)
知乎专栏:极光日报api