App crashes when tapping view in Notification Content Extension

Asked 2 years ago, Updated 2 years ago, 99 views

I'm trying to create RichNotification using iOS10's Notification Content Extension, but it's not working.

Only when you tap the view part of RichNotification while the app is not up, it crashes the moment the app starts.
If the app is in the foreground or background, tapping on the view part will work fine.

Also, the notification comes with a custom action, but it works fine in non-starting, foreground, or background.

I believe that the custom task is functioning without any problems, and that even if you tap view with an app in the foreground or background, delete etc. will not fail to be implemented.

When I looked at the log, I found that NSInvalidArgumentException failed only when I tapped view from non-boot state.Is the behavior of only the view tap when the application is not started differently?
If you know how to solve this problem, please let me know.

The following error log

User MyApp[57503]: *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'unable to serialize userInfo: Error Domain=NSCocoaErrorDomain Code=3851 "Property list invalid for format: 200 (property lists cannot contain objects of type 'CFNull')" UserInfo={NSDebugDescription=Property list invalid for format: 200 (property lists cannot contain objects of type 'CFNull')}'
*** First throw call stack:
(
    0 CoreFoundation 0x000000010dd9d34b__exceptionPreprocess+171
    1 libobjc.A.dylib0x000000010d7fe21eobjc_exception_throw+48
    2UIKit 0x000000010b8b252 - [UIConcreteLocalNotification userInfo] +0
    3UIKit 0x000000010b56ef2e_UNNotificationRequestToUILocalNotification+1540
    4UIKit0x000000010b56e8c6UNNotificationToUILocalNotification_block_invoke_2+74
    5UIKit0x000000010b1b8961 - [UIApplication_callInitializationDelegatesForMainScene:transitionContext:] +2522
    6UIKit0x000000010b1bf3b9 - [UIApplication_runWithMainScene:transitionContext:completion:] +1731
    7UIKit0x000000010b1bc539 - [UIApplication workspaceDidEndTransaction:] +188
    8 FrontBoardServices 0x00000001107ba76b_FBSSERIALQUEUE_IS_CALLING_OUT_TO_A_BLOCK_+24
    9 FrontBoardServices 0x00000001107ba5e4 - [FBSSerialQueue_performNext] +189
    10 FrontBoardServices 0x00000001107ba96d - [FBSSerialQueue_performNextFromRunLoopSource] +45
    11 CoreFoundation 0x000000010dd42311_CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION_+17
    12 CoreFoundation 0x000000010dd2759c_CFRunLoopDoSources0+556
    13 CoreFoundation 0x000000010dd26a86_CFRunLoopRun+918
    14 CoreFoundation 0x000000010dd26494 CFRunLoopRunSpecific+420
    15 UIKit 0x000000010b1badb6 - [UIApplication_run] +434
    16 UIKit0x000000010b1c0f34 UIApplicationMain+159
    17 MyApp 0x00000001066a398f main+111
    18 libdyld.dylib 0x000000010eb8e68d start+1
    19 ???0x00000000000000010x0+1
)

ios objective-c notification ios-app-extension

2022-09-30 21:19

1 Answers

Self-resolved.

It seems to occur if there is Null in UserNotification userInfo.
Null was included in the irrelevant data part, so it started working after converting to nil.


2022-09-30 21:19

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.