Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: App crashes on launch NSInvalidArgumentException - *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1] #1253

Closed
1 task done
sachithras opened this issue Apr 19, 2023 · 5 comments · Fixed by #1312

Comments

@sachithras
Copy link

sachithras commented Apr 19, 2023

What happened?

App crashes at launch, crashes are reported for only one user but multiple times (46 times), error description says App crashes on launch NSInvalidArgumentException - *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]

Steps to reproduce?

1. Launch the app (the firebase crash log is pasted for reference)

What did you expect to happen?

App should open without crashing

OneSignal iOS SDK version

Release 3.12.3

iOS version

15

Specific iOS version

+ iOS 15.7.3

Relevant log output

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x92c80 (Missing UUID 55c76f8ebcc93a4c9f6216eac0ba8ab8)
1  libobjc.A.dylib                0x14ee4 objc_exception_throw
2  CoreFoundation                 0x18d6b4 (Missing UUID 55c76f8ebcc93a4c9f6216eac0ba8ab8)
3  CoreFoundation                 0x18b0d8 (Missing UUID 55c76f8ebcc93a4c9f6216eac0ba8ab8)
4  CoreFoundation                 0x1fd28 (Missing UUID 55c76f8ebcc93a4c9f6216eac0ba8ab8)
5  CoreFoundation                 0x4973c (Missing UUID 55c76f8ebcc93a4c9f6216eac0ba8ab8)
6  OneSignal                      0x2e23c (Missing UUID ef4fff29da83381d8c05578e1b715417)
7  GoogleUtilities                0x6d2c (Missing UUID ff85b286b7093c03bdd66fc0154cd395)
8  libdispatch.dylib              0x63094 _dispatch_call_block_and_release
9  libdispatch.dylib              0x64094 _dispatch_client_callout
10 libdispatch.dylib              0x10d44 _dispatch_main_queue_drain
11 libdispatch.dylib              0x10994 _dispatch_main_queue_callback_4CF$VARIANT$mp
12 CoreFoundation                 0x4e034 (Missing UUID 55c76f8ebcc93a4c9f6216eac0ba8ab8)
13 CoreFoundation                 0xb538 (Missing UUID 55c76f8ebcc93a4c9f6216eac0ba8ab8)
14 CoreFoundation                 0x1e194 (Missing UUID 55c76f8ebcc93a4c9f6216eac0ba8ab8)
15 GraphicsServices               0x1988 GSEventRunModal
16 UIKitCore                      0x4e5a88 -[UIApplication _run]
17 UIKitCore                      0x27efc8 UIApplicationMain
18 libswiftUIKit.dylib            0x27ee4 UIApplicationMain(_:_:_:_:)
19 早报                             0x4d04 main (ZBClubNavigationStyle.swift)
20 ???                            0x1058984d0 (Missing)

Code of Conduct

  • I agree to follow this project's Code of Conduct
@emawby
Copy link
Contributor

emawby commented Apr 19, 2023

@sachithras Thank you for reporting do you have any more context about what OneSignal methods are being called leading to this crash? Do you know what the missing UUIDs are about?

@dimacorp
Copy link

We have same crash with a bit more information:

#0 (null) in __exceptionPreprocess ()
#1 (null) in objc_exception_throw ()
#2 (null) in _CFThrowFormattedException ()
#3 (null) in -[__NSPlaceholderDictionary initWithObjects:forKeys:count:].cold.5 ()
#4 (null) in -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] ()
#5 (null) in +[NSDictionary dictionaryWithObjects:forKeys:count:] ()
#6 (null) in +[OneSignalTrackFirebaseAnalytics trackInfluenceOpenEvent] ()
#7 (null) in +[OneSignal registerUserInternal] ()

Looking at this part in trackInfluenceOpenEvent it does not seem safe, dictionary can't hold nil's which is default line above:

NSString *notificationId = [sharedUserDefaults getSavedStringForKey:ONESIGNAL_FB_LAST_NOTIFICATION_ID_RECEIVED defaultValue:nil];
NSString *campaign = [sharedUserDefaults getSavedStringForKey:ONESIGNAL_FB_LAST_GAF_CAMPAIGN_RECEIVED defaultValue:nil];

[self logEventWithName:@"os_notification_influence_open"
            parameters:@{
                @"source": @"OneSignal",
                @"medium": @"notification",
                @"notification_id": notificationId,
                @"campaign": campaign
            }];

Any idea what's going on and how to fix?
The crash happens when opening app from push notification.

@maxim-velich-gismart
Copy link

maxim-velich-gismart commented Jul 12, 2023

@emawby Hello. I have the same issue for version 3.12.5
Screenshot 2023-07-12 at 13 59 49

Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x9cb4 __exceptionPreprocess
1 libobjc.A.dylib 0x183d0 objc_exception_throw
2 CoreFoundation 0x1aff84 -[__NSCFString characterAtIndex:].cold.1
3 CoreFoundation 0x1bb4ac -[__NSPlaceholderDictionary initWithCapacity:].cold.1
4 CoreFoundation 0x2545c -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]
5 CoreFoundation 0x252fc +[NSDictionary dictionaryWithObjects:forKeys:count:]
6 OneSignalCore 0x130ac (Missing UUID 28b5fe94c57737e796c3316d22dae287)
7 OneSignal 0xfa5c (Missing UUID 5a7e778e4c65352b8b682f18be52eb54)
8 libdispatch.dylib 0x2320 _dispatch_call_block_and_release
9 libdispatch.dylib 0x3eac _dispatch_client_callout
10 libdispatch.dylib 0x126a4 _dispatch_main_queue_drain
11 libdispatch.dylib 0x122f4 _dispatch_main_queue_callback_4CF
12 CoreFoundation 0x98c28 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE
13 CoreFoundation 0x7a560 __CFRunLoopRun
14 CoreFoundation 0x7f3ec CFRunLoopRunSpecific
15 GraphicsServices 0x135c GSEventRunModal
16 UIKitCore 0x39d6e8 -[UIApplication _run]
17 UIKitCore 0x39d34c UIApplicationMain
18 0x10f28c main + 14 (AppDelegate.swift:14)
19 ??? 0x1d88aedec (Missing)

@emawby
Copy link
Contributor

emawby commented Jul 31, 2023

Thank you for reporting we will investigate the issue

@ahmedsafadii
Copy link

the crash is still

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSPlaceholderDictionary initWithObjects:forKeys:count:]: attempt to insert nil object from objects[1]'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007ff8004ce95d __exceptionPreprocess + 242
	1   libobjc.A.dylib                     0x00007ff800090116 objc_exception_throw + 62
	2   CoreFoundation                      0x00007ff80053d7b9 -[__NSPlaceholderDictionary initWithObjects:forKeys:count:] + 604
	3   CoreFoundation                      0x00007ff8004cd139 +[NSDictionary dictionaryWithObjects:forKeys:count:] + 49
	4   OneSignalCore                       0x0000000106dc89c9 -[OneSignalClient handleJSONNSURLResponse:data:error:isAsync:withRequest:onSuccess:onFailure:] + 1989
	5   OneSignalCore                       0x0000000106dc7951 __54-[OneSignalClient executeRequest:onSuccess:onFailure:]_block_invoke + 57
	6   CFNetwork                           0x00007ff804c66d9f __40-[__NSURLSessionLocal taskForClassInfo:]_block_invoke + 559
	7   CFNetwork                           0x00007ff804c7fc1a __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke_2 + 191
	8   libdispatch.dylib                   0x00000001079a1b3d _dispatch_call_block_and_release + 12
	9   libdispatch.dylib                   0x00000001079a2ec6 _dispatch_client_callout + 8
	10  libdispatch.dylib                   0x00000001079aadcf _dispatch_lane_serial_drain + 1078
	11  libdispatch.dylib                   0x00000001079abb50 _dispatch_lane_invoke + 448
	12  libdispatch.dylib                   0x00000001079b8c76 _dispatch_root_queue_drain_deferred_wlh + 318
	13  libdispatch.dylib                   0x00000001079b819d _dispatch_workloop_worker_thread + 837
	14  libsystem_pthread.dylib             0x0000000107809c7f _pthread_wqthread + 326
	15  libsystem_pthread.dylib             0x0000000107808bdb start_wqthread + 15
)
libc++abi: terminating due to uncaught exception of type NSException

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants