NSInvalidArgumentException:-[MKMapItem encodeWithCoder:]:无法识别的选择器已发送到实例0x17034bfd0

时间:2018-06-25 16:53:12

标签: ios swift core-data mkmapitem

我收到了崩溃报告,该报告是有关将MKMapItem保存到数据存储中时无法识别的选择器发送到实例的。根据MKMapItem文档(MKMapItem Document),它符合NSSecureCoding,这意味着将其保存到NSManagedObject实例中应该没有问题。在ios 11版本上看起来还不错,因为我没有从使用该版本的设备收到崩溃报告。另外,我还将介绍可能在手机上保存MKMapItem的功能。上下文确实将NKMapItem保存到数据存储中,并且该功能正常工作。由于我的手机运行的是IOS 11,因此我认为这可能与版本系统有关?

如果误解了,请纠正我。

这是崩溃报告。

OS Version:          iPhone OS 10.3.3 (14G60)
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Last Exception Backtrace:
0   CoreFoundation                  0x181646fe0 __exceptionPreprocess + 124 (NSException.m:165)
1   libobjc.A.dylib                 0x1800a8538 objc_exception_throw + 56 (objc-exception.mm:521)
2   CoreFoundation                  0x18164def4 -[NSObject(NSObject) doesNotRecognizeSelector:] + 140 (NSObject.m:328)
3   CoreFoundation                  0x18164af54 ___forwarding___ + 916 (NSForwarding.m:3126)
4   CoreFoundation                  0x181546d4c _CF_forwarding_prep_0 + 92
5   Foundation                      0x18209afd4 _encodeObject + 1176 (NSKeyedArchiver.m:873)
6   Foundation                      0x1820a1e9c +[NSKeyedArchiver archivedDataWithRootObject:] + 168 (NSKeyedArchiver.m:421)
7   CoreData                        0x18391ae28 -[NSSQLiteConnection execute] + 1952 (NSSQLiteConnection.m:4165)
8   CoreData                        0x1839520e4 -[NSSQLiteConnection insertRow:] + 456 (NSSQLiteConnection.m:2966)
9   CoreData                        0x183ae3df8 _writeChangesForSaveRequest + 824 (NSSQLCore_Functions.m:1561)
10  CoreData                        0x183ae5584 _executeSaveChangesRequest + 388 (NSSQLCore_Functions.m:1622)
11  CoreData                        0x183adb5f0 -[NSSQLSaveChangesRequestContext executeRequestUsingConnection:] + 44 (NSSQLSaveChangesRequestContext.m:103)
12  CoreData                        0x1839f30c4 __52-[NSSQLDefaultConnectionManager handleStoreRequest:]_block_invoke + 256 (NSSQLConnectionManager.m:305)
13  libdispatch.dylib               0x1804fe9a0 _dispatch_client_callout + 16 (object.m:473)
14  libdispatch.dylib               0x18050bee0 _dispatch_barrier_sync_f_invoke + 84 (queue.c:3446)
15  CoreData                        0x1839f2f64 -[NSSQLDefaultConnectionManager handleStoreRequest:] + 208 (NSSQLConnectionManager.m:290)
16  CoreData                        0x183ab5824 -[NSSQLCoreDispatchManager routeStoreRequest:] + 272 (NSSQLCoreDispatchManager.m:56)
17  CoreData                        0x183a2075c -[NSSQLCore dispatchRequest:withRetries:] + 236 (NSSQLCore.m:2726)
18  CoreData                        0x183a1c578 -[NSSQLCore processSaveChanges:forContext:] + 200 (NSSQLCore.m:1569)
19  CoreData                        0x183920f10 -[NSSQLCore executeRequest:withContext:error:] + 724 (NSSQLCore.m:1923)
20  CoreData                        0x1839ff84c __65-[NSPersistentStoreCoordinator executeRequest:withContext:error:]_block_invoke + 3492 (NSPersistentStoreCoordinator.m:2820)
21  CoreData                        0x1839f80f0 -[NSPersistentStoreCoordinator _routeHeavyweightBlock:] + 276 (NSPersistentStoreCoordinator.m:586)
22  CoreData                        0x183920adc -[NSPersistentStoreCoordinator executeRequest:withContext:error:] + 408 (NSPersistentStoreCoordinator.m:2706)
23  CoreData                        0x18394197c -[NSManagedObjectContext save:] + 2548 (NSManagedObjectContext.m:1419)
24  myappName                       0x10009421c coreDataManager.saveContext() + 92 (coreDataManager.swift:514)
25  myappName                       0x1000b5970 closure #1 in eventUpdateManager.observeValue(forKeyPath:of:change:context:) + 64 (eventUpdateManager.swift:138)
26  myappName                       0x100124924 thunk for @escaping @callee_guaranteed () -> () + 36 (customAnimationController.swift:0)
27  libdispatch.dylib               0x1804fe9e0 _dispatch_call_block_and_release + 24 (init.c:963)
28  libdispatch.dylib               0x1804fe9a0 _dispatch_client_callout + 16 (object.m:473)
29  libdispatch.dylib               0x1805035e8 _dispatch_main_queue_callback_4CF + 996 (inline_internal.h:2431)
30  CoreFoundation                  0x1815f50c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1793)
31  CoreFoundation                  0x1815f2ce4 __CFRunLoopRun + 1572 (CFRunLoop.c:3004)
32  CoreFoundation                  0x181522da4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
33  GraphicsServices                0x182f8d074 GSEventRunModal + 100 (GSEvent.c:2245)
34  UIKit                           0x1877ddc9c UIApplicationMain + 208 (UIApplication.m:4089)
35  myappName                       0x10005da1c main + 56 (receiptCollectionViewCell.swift:18)
36  libdyld.dylib                   0x18053159c start + 4

Thread 0 name:
Thread 0 Crashed:
0   libsystem_kernel.dylib          0x0000000180641014 __pthread_kill + 8
1   libsystem_pthread.dylib         0x000000018070b264 pthread_kill + 112 (pthread.c:1366)
2   libsystem_c.dylib               0x00000001805b59c4 abort + 140 (abort.c:91)
3   myappName                       0x0000000100170ac8 uncaught_exception_handler + 72
4   CoreFoundation                  0x0000000181647354 __handleUncaughtException + 628 (NSException.m:218)
5   libobjc.A.dylib                 0x00000001800a8814 _objc_terminate() + 112 (objc-exception.mm:656)
6   myappName                       0x0000000100155408 MSCrashesUncaughtCXXTerminateHandler() + 732 (MSCrashesCXXExceptionHandler.mm:171)
7   libc++abi.dylib                 0x00000001800975d4 std::__terminate(void (*)()) + 16 (cxa_handlers.cpp:68)
8   libc++abi.dylib                 0x00000001800971a8 __cxa_rethrow + 144 (cxa_exception.cpp:584)
9   libobjc.A.dylib                 0x00000001800a86f8 objc_exception_rethrow + 44 (objc-exception.mm:559)
10  CoreData                        0x0000000183941cb0 -[NSManagedObjectContext save:] + 3368 (NSManagedObjectContext.m:1548)
11  myappName                       0x000000010009421c coreDataManager.saveContext() + 92 (coreDataManager.swift:514)
12  myappName                       0x00000001000b5970 closure #1 in eventUpdateManager.observeValue(forKeyPath:of:change:context:) + 64 (eventUpdateManager.swift:138)
13  myappName                       0x0000000100124924 thunk for @escaping @callee_guaranteed () -> () + 36 (customAnimationController.swift:0)
14  libdispatch.dylib               0x00000001804fe9e0 _dispatch_call_block_and_release + 24 (init.c:963)
15  libdispatch.dylib               0x00000001804fe9a0 _dispatch_client_callout + 16 (object.m:473)
16  libdispatch.dylib               0x00000001805035e8 _dispatch_main_queue_callback_4CF + 996 (inline_internal.h:2431)
17  CoreFoundation                  0x00000001815f50c8 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 12 (CFRunLoop.c:1793)
18  CoreFoundation                  0x00000001815f2ce4 __CFRunLoopRun + 1572 (CFRunLoop.c:3004)
19  CoreFoundation                  0x0000000181522da4 CFRunLoopRunSpecific + 424 (CFRunLoop.c:3113)
20  GraphicsServices                0x0000000182f8d074 GSEventRunModal + 100 (GSEvent.c:2245)
21  UIKit                           0x00000001877ddc9c UIApplicationMain + 208 (UIApplication.m:4089)
22  myappName                       0x000000010005da1c main + 56 (receiptCollectionViewCell.swift:18)
23  libdyld.dylib                   0x000000018053159c start + 4

0 个答案:

没有答案