jpush / jpush/jpush-react-native

iOS 可能出现 attempt to insert nil object from objects[2] 异常

Open
#871 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
1.4k
Forks
348
PR merge metrics
No merged PRs in 30d

Description

你的运行环境

  • 插件版本: 2.9.0
  • react-native 版本:0.63.4

期望效果

iOS 端正常运行

实际效果

iOS 端部分情况出现闪退,非必现,猜测是 RCTJPushModule.m 里 getAlias 出现 iAlias 为空赋值给 NSDictionary *data 导致报错:
-[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[2]

image

重现步骤

  1. 启动 App
  2. 调用 JPush.init(params)
  3. 调用 RN 端 JPush.queryAlias(params)

Debug logs

包括 Android 或 iOS 的日志:

Incident Identifier: 8B4F243B-0A89-46BE-AE3D-8FD526594539
Hardware Model: iPhone14,2
Process: **** [12019]
Path: /private/var/containers/Bundle/Application/6CCC2AAE-8084-433E-AA87-361241F32EBD/.app/
Identifier: com..
Version: 1.1.15 (4)
AppStoreTools: 13E114
AppVariant: 1:iPhone14,2:15
Code Type: ARM-64 (Native)
Role: Foreground
Parent Process: launchd [1]
Coalition: com.. [1548]

Date/Time: 2022-04-09 10:49:24.5475 +0800
Launch Time: 2022-04-09 10:46:11.5985 +0800
OS Version: iPhone OS 15.3.1 (19D52)
Release Type: User
Baseband Version: 1.41.06
Report Version: 104

Exception Type: EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note: EXC_CORPSE_NOTIFY
Triggered by Thread: 0

Last Exception Backtrace:
0 CoreFoundation 0x1807150fc __exceptionPreprocess + 220 (NSException.m:200)
1 libobjc.A.dylib 0x198f65d64 objc_exception_throw + 60 (objc-exception.mm:565)
2 CoreFoundation 0x18081e564 _CFThrowFormattedException + 116 (CFObject.m:2072)
3 CoreFoundation 0x1808296e0 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.5 + 52 (NSPlaceholderDictionary.m:71)
4 CoreFoundation 0x1806d2514 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 320 (NSPlaceholderDictionary.m:71)
5 CoreFoundation 0x1806f0ebc +[NSDictionary dictionaryWithObjects:forKeys:count:] + 60 (NSDictionary.m:609)
6 **** 0x1004b38b0 __27-[RCTJPushModule getAlias:]_block_invoke + 216 (RCTJPushModule.m:279)
7 libdispatch.dylib 0x180385924 _dispatch_call_block_and_release + 32 (init.c:1517)
8 libdispatch.dylib 0x180387670 _dispatch_client_callout + 20 (object.m:560)
9 libdispatch.dylib 0x180395b70 _dispatch_main_queue_callback_4CF + 944 (inline_internal.h:2601)
10 CoreFoundation 0x1806cdd84 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16 (CFRunLoop.c:1795)
11 CoreFoundation 0x180687f5c __CFRunLoopRun + 2540 (CFRunLoop.c:3144)
12 CoreFoundation 0x18069b468 CFRunLoopRunSpecific + 600 (CFRunLoop.c:3268)
13 GraphicsServices 0x19c23f38c GSEventRunModal + 164 (GSEvent.c:2200)
14 UIKitCore 0x18303e5d0 -[UIApplication _run] + 1100 (UIApplication.m:3493)
15 UIKitCore 0x182dbcf74 UIApplicationMain + 364 (UIApplication.m:5047)
16 **** 0x100469ad0 main + 88 (main.m:7)
17 dyld 0x1015b9aa4 start + 520 (dyldMain.cpp:879)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in ios/RCTJPushModule/RCTJPushModule.m at getAlias:, where the issue identifies iAlias being used to build the response dictionary. Reproduce the sequence JPush.init(params) followed by the React Native JPush.queryAlias(params) call, then verify that an unset alias no longer causes the iOS crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
objective-c, react-native
Domain
mobile
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.