jpush / jpush-react-native

JPush's officially supported React Native plugin (Android & iOS). 极光推送官方支持的 React Native 插件(Android & iOS)。
http://docs.jiguang.cn
MIT License
1.35k stars 340 forks source link

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

Open CoxHong opened 2 years ago

CoxHong commented 2 years ago

你的运行环境

期望效果

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)

q9liyan commented 2 years ago

插件版本: "jcore-react-native": "^1.9.5", "jpush-react-native": "^2.8.8",

ios 同样出现 iAlias 为nil 赋值给 NSDictionary *data 导致报错: