jpush-react-native icon indicating copy to clipboard operation
jpush-react-native copied to clipboard

iOS注册没反应

Open shixiaoquan opened this issue 3 years ago • 0 comments

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Q:iOS配置完成后,注册没反应, A:因为iOS原生代码中,注册时,使用的是 channel,但是在 js 集成代码中给提示是 titchannelle 原生代码


    if (params[@"appKey"] && params[@"channel"] && params[@"production"]) {
           // JPush初始化配置
           NSMutableDictionary *launchOptions = [NSMutableDictionary dictionaryWithDictionary:self.bridge.launchOptions];
           [JPUSHService setupWithOption:launchOptions appKey:params[@"appKey"]
                                 channel:params[@"channel"] apsForProduction:[params[@"production"] boolValue]];
      .....
    }

JS调用代码:

 JPush.init({
      appKey: "840dd6f72f11379f927dcd1", 
      // titchannelle: "dev",
      channel: "dev",
      production: true,
    });

Q:在TS项目中,使用 channel 注册时,可以成功,但是eslint 会报错 A:jpush-react-native 根目录 的 index.d.ts中,定义的 是 titchannelle,所以报错

以上问题已修复

Here is the diff that solved my problem:

diff --git a/node_modules/jpush-react-native/index.d.ts b/node_modules/jpush-react-native/index.d.ts
index 29d0681..7ee47eb 100644
--- a/node_modules/jpush-react-native/index.d.ts
+++ b/node_modules/jpush-react-native/index.d.ts
@@ -62,7 +62,7 @@ export default class JPush {
    */
   static init(params: {
     appKey: string;
-    titchannelle: string;
+    channel: string;
     production: boolean;
   }): void;
 

This issue body was partially generated by patch-package.

shixiaoquan avatar Apr 22 '22 03:04 shixiaoquan