jpush / jpush/jpush-react-native
iOS注册没反应
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.4k
- Forks
- 348
- PR merge metrics
- No merged PRs in 30d
Description
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch jpush-react-native@2.9.0 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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the repository-root index.d.ts and compare the JPush.init parameter declaration with the iOS native initialization shown in the issue. Verify that the TypeScript declaration matches the channel parameter used by the JS call, then run the project's available lint or type-check command to confirm the reported error is gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- objective-c, react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100