iospush-notificationios13remote-notifications

iOS 13 crash when receiving push notification?


We are experiencing a lot of the following crashes on iOS 13:

Crashed: com.twitter.crashlytics.ios.exception
0  MyApp                         0x1029626ac CLSProcessRecordAllThreads + 376 (CLSProcess.c:376)
1  MyApp                         0x102962a94 CLSProcessRecordAllThreads + 407 (CLSProcess.c:407)
2  MyApp                         0x102952798 CLSHandler + 26 (CLSHandler.m:26)
3  MyApp                         0x102960cc0 __CLSExceptionRecord_block_invoke + 199 (CLSException.mm:199)
4  libdispatch.dylib              0x1994911cc _dispatch_client_callout + 16
5  libdispatch.dylib              0x199443d04 _dispatch_lane_barrier_sync_invoke_and_complete + 56
6  MyApp                         0x102960768 CLSExceptionRecord + 206 (CLSException.mm:206)
7  MyApp                         0x10296059c CLSExceptionRecordNSException + 102 (CLSException.mm:102)
8  MyApp                         0x1029601c0 CLSTerminateHandler() + 259 (CLSException.mm:259)
9  libc++abi.dylib                0x199591304 std::__terminate(void (*)()) + 16
10 libc++abi.dylib                0x19959129c std::terminate() + 44
11 libobjc.A.dylib                0x1994ec2dc _objc_terminate() + 10
12 libdispatch.dylib              0x1994911e0 _dispatch_client_callout + 36
13 libdispatch.dylib              0x199443d04 _dispatch_lane_barrier_sync_invoke_and_complete + 56
14 BaseBoard                      0x19c307ccc -[BSAction sendResponse:withCompletion:] + 116
15 UIKitCore                      0x19d341558 -[UIHandleRemoteNotificationAction sendResponse:] + 128
16 UIKitCore                      0x19d7bb250 __91-[UIApplication _handleNonLaunchSpecificActions:forScene:withTransitionContext:completion:]_block_invoke_3.2661 + 72
17 UIKitCore                      0x19d7af014 _runAfterCACommitDeferredBlocks + 316
18 UIKitCore                      0x19d79f064 _cleanUpAfterCAFlushAndRunDeferredBlocks + 232
19 UIKitCore                      0x19d7ce80c _afterCACommitHandler + 76
20 CoreFoundation                 0x1997404f8 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
21 CoreFoundation                 0x19973b3e4 __CFRunLoopDoObservers + 416
22 CoreFoundation                 0x19973b9b0 __CFRunLoopRun + 1308
23 CoreFoundation                 0x19973b16c CFRunLoopRunSpecific + 464
24 GraphicsServices               0x1a3573328 GSEventRunModal + 104
25 UIKitCore                      0x19d7a5d0c UIApplicationMain + 1936
26 MyApp                         0x1021fa41c main + 22 (main.m:22)
27 libdyld.dylib                  0x1995c6424 start + 4

With the following message:

Fatal Exception: NSInternalInconsistencyException this request has been neutered - you can't call -sendResponse: twice nor after encoding it +[_CFXNotificationTokenRegistration keyCallbacks]

Has anyone an idea what is causing this crash? The following line15 UIKitCore 0x19d341558 -[UIHandleRemoteNotificationAction sendResponse:] + 128 indicates that this is happening when receiving a remote notification I guess, not sure though. Can this relate to not calling the fetchCompletionHandlercallback properly when receiving a remote notification? Thankful for any suggestions, thx :)


Solution

  • I think you should implement fetchCompletionHandler even if it is an optional method. As Apple mentions in the documentation:

    If you do not call the completion handler in time, your app is terminated

    Quick fix: implement this delegate correctly... iOS 13 should let you go.

    Sidenote: iOS 13 is quite picky about all the historical backgrounding stuff and Apple added those kind of watchdogs to kill you if it looks like you do not use the backgrounding features academically… same sad story for a lot of apps with the VoIP push ;-)