iOS-[NSString encodeWithCoder:]崩溃

时间:2018-07-27 05:44:53

标签: ios objective-c ios11

myApp在本地推送中发生随机崩溃,崩溃报告显示以下内容。

Application Specific Information:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: '(null)'

Thread 33 Crashed:
0   CoreFoundation                  __exceptionPreprocess + 228
1   libobjc.A.dylib                 objc_exception_throw + 56
2   CoreFoundation                  -[NSException initWithCoder:] + 0
3   Foundation                      -[NSString encodeWithCoder:] + 512
4   UserNotifications               -[UNLocalizedString encodeWithCoder:] + 80
5   Foundation                      -[NSXPCEncoder _encodeObject:] + 656
6   UserNotifications               -[UNNotificationContent encodeWithCoder:] + 260
7   Foundation                      -[NSXPCEncoder _encodeObject:] + 656
8   UserNotifications               -[UNNotificationRequest encodeWithCoder:] + 104
9   Foundation                      -[NSXPCEncoder _encodeObject:] + 656
10  Foundation                      _NSXPCSerializationAddInvocationWithOnlyObjectArgumentsArray + 156
11  Foundation                      -[NSXPCEncoder _encodeInvocationObjectArgumentsOnly:count:typeString:selector:isReply:into:] + 200
12  Foundation                      -[NSXPCConnection _sendInvocation:orArguments:count:methodSignature:selector:withProxy:] + 2608
13  Foundation                      -[NSXPCConnection _sendSelector:withProxy:arg1:arg2:arg3:] + 144
14  Foundation                      _NSXPCDistantObjectSimpleMessageSend3 + 72
15  UserNotifications               __104-[UNUserNotificationServiceConnection addNotificationRequest:forBundleIdentifier:withCompletionHandler:]_block_invoke + 236
16  libdispatch.dylib               _dispatch_call_block_and_release + 24
17  libdispatch.dylib               _dispatch_client_callout + 16
18  libdispatch.dylib               _dispatch_queue_serial_drain$VARIANT$armv81 + 568
19  libdispatch.dylib               _dispatch_queue_invoke$VARIANT$armv81 + 328
20  libdispatch.dylib               _dispatch_root_queue_drain_deferred_wlh$VARIANT$armv81 + 332
21  libdispatch.dylib               _dispatch_workloop_worker_thread$VARIANT$armv81 + 612
22  libsystem_pthread.dylib         _pthread_wqthread + 860
23  libsystem_pthread.dylib         start_wqthread + 4

所有这些看起来都是内部方法。我在iOS11上遇到了这些崩溃。

本地推送代码

UILocalNotification *notification = [[UILocalNotification alloc] init];
notification.alertBody = alertBody;
notification.soundName = soundName;
notification.userInfo = userInfo;
notification.category = category;
notification.repeatInterval = 0;
notification.timeZone = [NSTimeZone defaultTimeZone];
[[UIApplication sharedApplication] presentLocalNotificationNow:notification];

0 个答案:

没有答案