urbanairship / ios-library

Urban Airship iOS SDK
http://urbanairship.com
Apache License 2.0
478 stars 265 forks source link

SharedURLSession crash during runtime on Release Configuration #385

Closed jcholuj closed 8 months ago

jcholuj commented 8 months ago

❗For how-to inquiries involving Airship functionality or use cases, please contact (support)[https://support.airship.com/].

Preliminary Info

What Airship dependencies are you using?

AirshipCore, 17.7.0 AirshipAutomation, 17.7.0 AirshipMessageCenter, 17.7.0

Report

What unexpected behavior are you seeing?

When building release configuration there is a runtime crash on Airship.takeoff() method: "object cannot be nil" when accessing "sharedURLSession" during Airship initialisation. We use SPM for managing libraries.

What is the expected behavior?

The takeoff() method should finalise successfully.

What are the steps to reproduce the unexpected behavior?

Building project with release configuration.

Do you have logging for the issue?

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[__NSArrayM insertObject:atIndex:]: object cannot be nil'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007ff80049928d __exceptionPreprocess + 242
    1   libobjc.A.dylib                     0x00007ff800063894 objc_exception_throw + 48
    2   CoreFoundation                      0x00007ff80037a0cb -[__NSArrayM removeObjectAtIndex:] + 0
    3   AppName                              0x00000001061e6194 +[NSURLSessionConfiguration(DBURLProtocol) db_defaultSessionConfiguration] + 138
    4   AppName                              0x0000000105912132 $s11AirshipCore07DefaultA14RequestSessionC16sharedURLSession33_EE93111D53DE4B0AB2B9533A50D78894LL_WZ + 34
    5   libdispatch.dylib                   0x0000000108d069f7 _dispatch_client_callout + 8
    6   libdispatch.dylib                   0x0000000108d08095 _dispatch_once_callout + 66
    7   AppName                              0x00000001058ef4c7 $s11AirshipCore0A8InstanceC6configAcA0A6ConfigC_tcfc + 5271
    8   AppName                              0x00000001058c15ef $s11AirshipCore0A0C13commonTakeOff33_B8C56DC6CB65D237E97120AD2B9D29B5LLyyAA0A6ConfigCSgFZTf4nd_n + 447
    9   AppName                              0x00000001058c1a54 $s11AirshipCore0A0C7takeOff_13launchOptionsyAA0A6ConfigCSg_SDySo019UIApplicationLaunchF3KeyaypGSgtFZTf4nnd_n + 516
    10  AppName                              0x000000010568c435 $s6AppName17EngagementServiceC5setup13launchOptionsySDySo019UIApplicationLaunchF3KeyaypGSg_tF + 133
    11  AppName                              0x000000010554855b $s6AppName11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFyycfU_Tf4ndn_n + 507
    12  AppName                              0x0000000105549563 $s6AppName11AppDelegateC21checkStartupArguments33_B6F41B53CF005AD52167F0C4F58F713DLL4thenyyyc_tF011$s6AppName11bC100C11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6Launch   13  AppName                              0x0000000105545298 $s6AppName11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtFTo + 232
    14  UIKitCore                           0x00007ff805b6be12 -[UIApplication _handleDelegateCallbacksWithOptions:isSuspended:restoreState:] + 297
    15  UIKitCore                           0x00007ff805b6dbeb -[UIApplication _callInitializationDelegatesWithActions:forCanvas:payload:fromOriginatingProcess:] + 4253
    16  UIKitCore                           0x00007ff805b73762 -[UIApplication _runWithMainScene:transitionContext:completion:] + 1241
    17  UIKitCore                           0x00007ff804ebb64d -[_UISceneLifecycleMultiplexer completeApplicationLaunchWithFBSScene:transitionContext:] + 122
    18  UIKitCore                           0x00007ff805596e1a _UIScenePerformActionsWithLifecycleActionMask + 87
    19  UIKitCore                           0x00007ff804ebc1ab __101-[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:]_block_invoke + 198
    20  UIKitCore                           0x00007ff804ebbc0c -[_UISceneLifecycleMultiplexer _performBlock:withApplicationOfDeactivationReasons:fromReasons:] + 249
    21  UIKitCore                           0x00007ff804ebbff4 -[_UISceneLifecycleMultiplexer _evalTransitionToSettings:fromSettings:forceExit:withTransitionStore:] + 813
    22  UIKitCore                           0x00007ff804ebb820 -[_UISceneLifecycleMultiplexer uiScene:transitionedFromState:withTransitionContext:] + 341
    23  UIKitCore                           0x00007ff804ec7da0 __186-[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:]_blo  24  UIKitCore                           0x00007ff805449008 +[BSAnimationSettings(UIKit) tryAnimatingWithSettings:fromCurrentState:actions:completion:] + 865
    25  UIKitCore                           0x00007ff8055b543b _UISceneSettingsDiffActionPerformChangesWithTransitionContextAndCompletion + 261
    26  UIKitCore                           0x00007ff804ec7a2f -[_UIWindowSceneFBSSceneTransitionContextDrivenLifecycleSettingsDiffAction _performActionsForUIScene:withUpdatedFBSScene:settingsDiff:fromSettings:transitionContext:lifecycleActionType:] + 347
    27  UIKitCore                           0x00007ff804ca017f __64-[UIScene scene:didUpdateWithDiff:transitionContext:completion:]_block_invoke.610 + 877
    28  UIKitCore                           0x00007ff804c9eb34 -[UIScene _emitSceneSettingsUpdateResponseForCompletion:afterSceneUpdateWork:] + 245
    29  UIKitCore                           0x00007ff804c9fce7 -[UIScene scene:didUpdateWithDiff:transitionContext:completion:] + 252
    30  UIKitCore                           0x00007ff805b71fb4 -[UIApplication workspace:didCreateScene:withTransitionContext:completion:] + 672
    31  UIKitCore                           0x00007ff80547df66 -[UIApplicationSceneClientAgent scene:didInitializeWithEvent:completion:] + 353
    32  FrontBoardServices                  0x00007ff8078666ad -[FBSScene _callOutQueue_didCreateWithTransitionContext:completion:] + 406
    33  FrontBoardServices                  0x00007ff8078987bb __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke.254 + 279
    34  FrontBoardServices                  0x00007ff807876313 -[FBSWorkspace _calloutQueue_executeCalloutFromSource:withBlock:] + 213
    35  FrontBoardServices                  0x00007ff8078984b5 __92-[FBSWorkspaceScenesClient createSceneWithIdentity:parameters:transitionContext:completion:]_block_invoke + 328
    36  libdispatch.dylib                   0x0000000108d069f7 _dispatch_client_callout + 8
    37  libdispatch.dylib                   0x0000000108d0a389 _dispatch_block_invoke_direct + 507
    38  FrontBoardServices                  0x00007ff8078c3e3d __FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK__ + 30
    39  FrontBoardServices                  0x00007ff8078c3d17 -[FBSMainRunLoopSerialQueue _targetQueue_performNextIfPossible] + 188
    40  FrontBoardServices                  0x00007ff8078c3e65 -[FBSMainRunLoopSerialQueue _performNextFromRunLoopSource] + 19
    41  CoreFoundation                      0x00007ff8003f5d0f __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
    42  CoreFoundation                      0x00007ff8003f5c51 __CFRunLoopDoSource0 + 157
    43  CoreFoundation                      0x00007ff8003f544e __CFRunLoopDoSources0 + 215
    44  CoreFoundation                      0x00007ff8003efb83 __CFRunLoopRun + 919
    45  CoreFoundation                      0x00007ff8003ef409 CFRunLoopRunSpecific + 557
    46  GraphicsServices                    0x00007ff80fcdd187 GSEventRunModal + 137
    47  UIKitCore                           0x00007ff805b703a2 -[UIApplication _run] + 972
    48  UIKitCore                           0x00007ff805b74e10 UIApplicationMain + 123
    49  AppName                              0x0000000105547f28 main + 56
    50  dyld                                0x00000001085133ee start_sim + 10
    51  ???                                 0x00000001087cb3a6 0x0 + 4437357478
)
libc++abi: terminating due to uncaught exception of type NSException
rlepinski commented 8 months ago

@jcholuj Sorry about missing this issue, did you get it resolved?

jcholuj commented 8 months ago

@rlepinski yes, occurred it was a problem with another library which used method swizzling.