-
Notifications
You must be signed in to change notification settings - Fork 266
Description
What happened?
Our app is experiencing a runtime crash inside the OneSignal iOS SDK when the SDK attempts to fetch In-App Messages.
The crash consistently happens inside:
OSMessagingController → attemptFetchWithRetries:rywData:
OneSignalClient → handleJSONNSURLResponse:data:error:
The exception thrown is:
NSInvalidArgumentException
+[NSObject(NSObject) _copyDescription]
unrecognized selector sent to instance
Based on investigation, the SDK is receiving an unexpected JSON value (likely NSNull or wrong type) in the IAM fetch response. The SDK then calls _copyDescription on that value during retry handling, which causes a fatal crash.
This is happening in production and is completely outside of our app logic. It appears to be a type-safety bug in the OneSignal SDK.
Steps to reproduce?
1. Integrate OneSignal SDK into an iOS app (In-App Messaging enabled).
2. Launch the app on a real device.
3. Allow OneSignal to attempt an IAM fetch from the server.
4. When the server returns a malformed or null IAM field during retry handling,
the SDK crashes with NSInvalidArgumentException.
5. Crash appears to originate from passing NSNull / invalid object to _copyDescription.What did you expect to happen?
The OneSignal SDK should safely handle unexpected or null JSON values in the IAM response.
Malformed fields (such as null, empty dictionary, or wrong type) should not cause the SDK to call selectors that the object does not support.
The app should continue running normally without crashing, even if IAM data is invalid or incomplete.
Stack Traace:
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x11a2ec __exceptionPreprocess
1 libobjc.A.dylib 0x31a7c objc_exception_throw
2 CoreFoundation 0x18467c +[NSObject(NSObject) _copyDescription]
3 CoreFoundation 0x31b84 ___forwarding___
4 CoreFoundation 0x314f0 _CF_forwarding_prep_0
5 OneSignalInAppMessages 0xba80 __77-[OSMessagingController attemptFetchWithRetries:rywData:attempts:retryLimit:]_block_invoke.90
6 OneSignalCore 0x9e50 -[OneSignalClient handleJSONNSURLResponse:data:error:isAsync:withRequest:onSuccess:onFailure:]
7 OneSignalCore 0x9338 __54-[OneSignalClient executeRequest:onSuccess:onFailure:]_block_invoke
8 CFNetwork 0x30750 __40-[__NSURLSessionLocal taskForClassInfo:]_block_invoke
9 CFNetwork 0x30510 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke_2
10 libdispatch.dylib 0x1aac _dispatch_call_block_and_release
11 libdispatch.dylib 0x1b584 _dispatch_client_callout
12 libdispatch.dylib 0xa2d0 _dispatch_lane_serial_drain
13 libdispatch.dylib 0xade0 _dispatch_lane_invoke
14 libdispatch.dylib 0x151dc _dispatch_root_queue_drain_deferred_wlh
15 libdispatch.dylib 0x14a60 _dispatch_workloop_worker_thread
16 libsystem_pthread.dylib 0x4660 _pthread_wqthread
17 libsystem_pthread.dylib 0x19f8 start_wqthread
OneSignal iOS SDK version
5.2.8
iOS version
16
Specific iOS version
* iOS 15
* iOS 16
* iOS 17 (seen on multiple devices)Relevant log output
Fatal Exception: NSInvalidArgumentException
0 CoreFoundation 0x11a2ec __exceptionPreprocess
1 libobjc.A.dylib 0x31a7c objc_exception_throw
2 CoreFoundation 0x18467c +[NSObject(NSObject) _copyDescription]
3 CoreFoundation 0x31b84 ___forwarding___
4 CoreFoundation 0x314f0 _CF_forwarding_prep_0
5 OneSignalInAppMessages 0xba80 __77-[OSMessagingController attemptFetchWithRetries:rywData:attempts:retryLimit:]_block_invoke.90
6 OneSignalCore 0x9e50 -[OneSignalClient handleJSONNSURLResponse:data:error:isAsync:withRequest:onSuccess:onFailure:]
7 OneSignalCore 0x9338 __54-[OneSignalClient executeRequest:onSuccess:onFailure:]_block_invoke
8 CFNetwork 0x30750 __40-[__NSURLSessionLocal taskForClassInfo:]_block_invoke
9 CFNetwork 0x30510 __49-[__NSCFLocalSessionTask _task_onqueue_didFinish]_block_invoke_2
10 libdispatch.dylib 0x1aac _dispatch_call_block_and_release
11 libdispatch.dylib 0x1b584 _dispatch_client_callout
12 libdispatch.dylib 0xa2d0 _dispatch_lane_serial_drain
13 libdispatch.dylib 0xade0 _dispatch_lane_invoke
14 libdispatch.dylib 0x151dc _dispatch_root_queue_drain_deferred_wlh
15 libdispatch.dylib 0x14a60 _dispatch_workloop_worker_thread
16 libsystem_pthread.dylib 0x4660 _pthread_wqthread
17 libsystem_pthread.dylib 0x19f8 start_wqthreadCode of Conduct
- I agree to follow this project's Code of Conduct