收到推送通知时,iOS 13崩溃了吗?

时间:2019-09-23 09:10:17

标签: ios push-notification ios13 remote-notifications

我们在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

显示以下消息:

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

有人知道导致此崩溃的原因吗?以下行15 UIKitCore 0x19d341558 -[UIHandleRemoteNotificationAction sendResponse:] + 128表示这是我收到的(虽然不确定)在收到远程通知时发生的情况。这是否与收到远程通知时未正确调用fetchCompletionHandler回调有关?感谢任何建议,谢谢:)

2 个答案:

答案 0 :(得分:3)

我认为您应该实现fetchCompletionHandler,即使它是可选方法也是如此。 正如苹果提到的in the documentation

  

如果您未及时调用完成处理程序,则您的应用将被终止

快速修复:正确实现此委托... iOS 13应该让您放手。

旁注:iOS 13对于所有历史背景知识都相当挑剔,如果看起来您在学术上不使用背景功能,苹果会添加这种看门狗来杀死您……对于使用VoIP的许多应用程序来说,这同样令人遗憾推送;-)

答案 1 :(得分:0)

尽管我不知道Crashlytics的实现细节,但iOS 13不再支持使用Data对象注册远程通知的先前众所周知的模式,这可能会导致崩溃。

此答案中的区别在于:

Does iOS 13 has new way of getting device notification token?