Skip to content

Fatal Exception [NSJSONSerialization dataWithJSONObject:options:error:]: value parameter is nil  #343

@freemansion

Description

@freemansion

Hi there. We're currently experiencing crash due improperly handled nil value inside Rollbar SDK.
Here is more context:

Crash description
App crashes during cold start with following end of stacktrace:

RollbarHandler.initRollbarWithUser(phone:userName:)
NSInvalidArgumentException - -[__NSCFString objectForKey:]: unrecognized selector sent to instance <address>

Rollbar-Apple SDK version: v.3.2.1
revision: 8f22dec

46 crashes / 18 users
Operating systems
65% iOS 16
35% iOS 17

Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x9e88 __exceptionPreprocess
1  libobjc.A.dylib                0x178d8 objc_exception_throw
2  Foundation                     0x51140 +[NSData(NSData) dataWithBytesNoCopy:length:freeWhenDone:]
3  RollbarCommon                  0x43c0 +[NSJSONSerialization(Rollbar) rollbar_dataWithJSONObject:options:error:safe:] + 43 (NSJSONSerialization+Rollbar.m:43)
4  RollbarNotifier                0x14b00 -[RollbarSession saveSessionState:] + 488 (RollbarSession.m:488)
5  RollbarNotifier                0x13c9c -[RollbarSession enableOomMonitoring:withCrashCheck:] + 127 (RollbarSession.m:127)
6  RollbarNotifier                0xa924 -[RollbarInfrastructure configureWith:andCrashCollector:] + 76 (RollbarInfrastructure.m:76)
7  RollbarNotifier                0x4110 +[Rollbar initWithAccessToken:configuration:crashCollector:] + 79 (Rollbar.m:79)
8  App Name                       0x286458 RollbarHandler.initRollbarWithUser(phone:userName:) + 49 (RollbarHandler.swift:49)
9  App Name                       0x421df8 AppDelegate.application(_:didFinishLaunchingWithOptions:) + 80 (AppDelegate.swift:80)
10 App Name                       0x4282b0 @objc AppDelegate.application(_:didFinishLaunchingWithOptions:) (<compiler-generated>)
11 UIKitCore                      0x35a888 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:]
12 UIKitCore                      0x359fac -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:]
13 UIKitCore                      0x358f88 -[UIApplication _runWithMainScene:transitionContext:completion:]
14 UIKitCore                      0x358bd4 -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:]
15 UIKitCore                      0x9e600 _UIScenePerformActionsWithLifecycleActionMask
16 UIKitCore                      0x3e0918 __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke
17 UIKitCore                      0x291014 -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:]
18 UIKitCore                      0x290dcc -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]
19 UIKitCore                      0x29097c -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:]
20 UIKitCore                      0x290848 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_block_invoke
21 UIKitCore                      0x972fa8 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:]
22 UIKitCore                      0xa0bf98 _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion
23 UIKitCore                      0x13c958 -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]
24 UIKitCore                      0x5af7a8 __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.214
25 UIKitCore                      0x20f0b8 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:]
26 UIKitCore                      0x20ef28 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:]
27 UIKitCore                      0x20e47c -[UIApplication workspace:didCreateScene:withTransitionContext:completion:]
28 UIKitCore                      0x20e208 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:]
29 FrontBoardServices             0x3500 -[FBSScene _callOutQueue_agent_didCreateWithTransitionContext:completion:]
30 FrontBoardServices             0x4251c __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.78
31 FrontBoardServices             0x7294 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:]
32 FrontBoardServices             0x42154 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke
33 libdispatch.dylib              0x3fdc _dispatch_client_callout
34 libdispatch.dylib              0x7a5c _dispatch_block_invoke_direct
35 FrontBoardServices             0x113b0 __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__
36 FrontBoardServices             0x10f4c -[FBSSerialQueue _targetQueue_performNextIfPossible]
37 FrontBoardServices             0x1372c -[FBSSerialQueue _performNextFromRunLoopSource]
38 CoreFoundation                 0xd5f54 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__
39 CoreFoundation                 0xe232c __CFRunLoopDoSource0
40 CoreFoundation                 0x66270 __CFRunLoopDoSources0
41 CoreFoundation                 0x7bba8 __CFRunLoopRun
42 CoreFoundation                 0x80ed4 CFRunLoopRunSpecific
43 GraphicsServices               0x1368 GSEventRunModal
44 UIKitCore                      0x3a23d0 -[UIApplication _run]
45 UIKitCore                      0x3a2034 UIApplicationMain
46 App Name                       0x429e38 main + 26 (AppDelegate.swift:26)
47 ???                            0x1da9c8960 (Missing)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions