OneSignal / OneSignal-iOS-SDK

OneSignal is a free push notification service for mobile apps. This plugin makes it easy to integrate your native iOS app with OneSignal. https://onesignal.com
Other
496 stars 263 forks source link

[Bug]: [OneSignalAttachmentHandler trimURLSpacing:] crash #1400

Closed DenTelezhkin closed 6 months ago

DenTelezhkin commented 7 months ago

What happened?

We are getting a lot of crash reports from Apple (thousands) about this issue. This crash is in notification extension, so not necessarily visible to users, but may cause push notifications to malfunction (particularly in-app messages).

Steps to reproduce?

Unfortunately, I don't have any, I was not able to reproduce this issue on my side.

What did you expect to happen?

Notification extension to not crash. Unfortunately, it does, attaching crash log:

2024-04-0811-15-02.7507+0000-107575d31fde83b8356216cb6975692313f1e198.crash.zip

OneSignal iOS SDK version

5.0.5

iOS version

* iOS 17, however this may be because most of app clients are on iOS 17.

Code of Conduct

tom-willmowski commented 7 months ago

I've got the same issue. Can you help?

JMCPH commented 7 months ago

I'm experiencing the same issue 👀 Did you find a solution for this?

nan-li commented 7 months ago

Hi everyone, thank you for reporting. We have identified the issue and will implement the fix.

The OP has this stacktrace in the zipped log:

AppVariant:          1:iPad7,11:15
Code Type:           ARM-64 (Native)

Date/Time:           2023-12-06 15:25:49.2212 -0800
Launch Time:         2023-12-06 15:25:49.1503 -0800
OS Version:          iPhone OS 17.1.2 (21B101)
Release Type:        User
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Reason: -[NSNull stringByTrimmingCharactersInSet:]: unrecognized selector sent to instance 0x1fb985c20
Termination Reason: SIGNAL 6 Abort trap: 6
Terminating Process: OneSignalNotificationServiceExte [1097]

Triggered by Thread:  1

Last Exception Backtrace:
0   CoreFoundation                  0x1ad883960 __exceptionPreprocess + 160 (NSException.m:249)
1   libobjc.A.dylib                 0x1a5ebf658 objc_exception_throw + 56 (objc-exception.mm:356)
2   CoreFoundation                  0x1ad90d51c -[NSObject(NSObject) doesNotRecognizeSelector:] + 340 (NSObject.m:161)
3   CoreFoundation                  0x1ad7cf6d8 ___forwarding___ + 1312 (NSForwarding.m:3612)
4   CoreFoundation                  0x1ad90332c _CF_forwarding_prep_0 + 92 (:-1)
5   OneSignalExtension              0x102bebf70 +[OneSignalAttachmentHandler trimURLSpacing:] + 84 (OneSignalAttachmentHandler.m:313)
6   OneSignalExtension              0x102beb8d4 +[OneSignalAttachmentHandler addAttachments:toNotificationContent:] + 544 (OneSignalAttachmentHandler.m:212)
7   OneSignalExtension              0x102be97fc +[OneSignalNotificationServiceExtensionHandler didReceiveNotificationExtensionRequest:withMutableNotificationContent:withContentHandler:] + 564 (OneSignalNotificationServiceExtensionHandler.m:80)
8   OneSignalNotificationServiceExtension   0x1026920a0 NotificationService.didReceive(_:withContentHandler:) + 464 (NotificationService.swift:15)
9   OneSignalNotificationServiceExtension   0x102692204 @objc NotificationService.didReceive(_:withContentHandler:) + 112 (<compiler-generated>:0)
10  UserNotifications               0x1d1d2ebe0 -[_UNNotificationServiceExtensionRemoteContext didReceiveNotificationRequest:withCompletionHandler:] + 328 (_UNNotificationServiceExtensionRemoteContext.m:55)
11  Foundation                      0x1ac8868dc __NSXPCCONNECTION_IS_CALLING_OUT_TO_EXPORTED_OBJECT_S2__ + 12 (NSXPCConnection.m:196)
12  Foundation                      0x1ac884814 -[NSXPCConnection _decodeAndInvokeMessageWithEvent:reply:flags:] + 1576 (NSXPCConnection.m:708)
13  Foundation                      0x1ac884154 message_handler_message + 84 (NSXPCConnection.m:826)
14  Foundation                      0x1acf63e08 message_handler + 148 (NSXPCConnection.m:797)
15  libxpc.dylib                    0x211631090 _xpc_connection_call_event_handler + 68 (connection.c:0)
16  libxpc.dylib                    0x211631480 _xpc_connection_mach_event + 952 (connection.c:2426)
17  libdispatch.dylib               0x1b4f5f014 _dispatch_client_callout4 + 16 (object.m:601)
18  libdispatch.dylib               0x1b4f17bc4 _dispatch_mach_msg_invoke$VARIANT$mp + 380 (mach.c:2511)
19  libdispatch.dylib               0x1b4f06b48 _dispatch_lane_serial_drain$VARIANT$mp + 336 (queue.c:3885)
20  libdispatch.dylib               0x1b4f18790 _dispatch_mach_invoke$VARIANT$mp + 448 (mach.c:2861)
21  libdispatch.dylib               0x1b4f06b48 _dispatch_lane_serial_drain$VARIANT$mp + 336 (queue.c:3885)
22  libdispatch.dylib               0x1b4f07738 _dispatch_lane_invoke$VARIANT$mp + 380 (queue.c:3976)
23  libdispatch.dylib               0x1b4f10f4c _dispatch_root_queue_drain_deferred_wlh + 252 (queue.c:6913)
24  libdispatch.dylib               0x1b4f1085c _dispatch_workloop_worker_thread + 404 (queue.c:6507)
25  libsystem_pthread.dylib         0x2115dba70 _pthread_wqthread + 284 (pthread.c:2629)
26  libsystem_pthread.dylib         0x2115dbb10 start_wqthread + 8 (:-1)
emawby commented 7 months ago

Fix is in #1411