调试Realm,调用堆栈没有任何应用程序代码

时间:2017-11-05 19:00:56

标签: swift realm stack-trace

我已经碰到过几次,因为Realm正在尝试做的事情,应用程序会崩溃,但是调用堆栈根本没用。它让我接近(TouchesEnded),但我认为它应该更准确一些。有没有办法更接近?在过去,我能够弄明白,因为崩溃信息非常明显,但这个可能发生在任何地方。想法?

  

因未捕获的异常终止应用'无效的值',原因:   '属性类型字符串的预期对象' id'对象的类型   ' DrawingNode',但收到:1'

*** First throw call stack: (
0   CoreFoundation                      0x000000010713a1ab __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00000001067cff41 objc_exception_throw + 48
2   Realm                               0x0000000105190d31 _ZL15RLMPreconditionbP8NSStringS0_z + 657
3   Realm                               0x00000001052791b3 _ZN12_GLOBAL__N_123validate_property_valueERKNS_15ColumnReferenceEP11objc_objectP8NSStringP15RLMObjectSchemaS6_ + 1011
4   Realm                               0x0000000105195ee7 _ZN12_GLOBAL__N_112QueryBuilder22apply_value_expressionEP15RLMObjectSchemaP8NSStringP11objc_objectP21NSComparisonPredicate + 631
5   Realm                               0x00000001051928a3 _ZN12_GLOBAL__N_112QueryBuilder15apply_predicateEP11NSPredicateP15RLMObjectSchema + 5075
6   Realm                               0x0000000105190eeb _Z19RLMPredicateToQueryP11NSPredicateP15RLMObjectSchemaP9RLMSchemaRN5realm5GroupE + 347
7   Realm                               0x0000000105152164 -[RLMManagedArray objectsWithPredicate:] + 324
8   RealmSwift                          0x0000000105c23d17 _T010RealmSwift4ListC6filterAA7ResultsCyxGSS_SayypGdtF + 231
9   DrawingApp                          0x0000000103fdb59a _T010DrawingApp0A5SceneC12touchesEndedys3SetVySo7UITouchCG_So7UIEventCSg4withtF + 26586
10  DrawingApp                          0x0000000103fdda88 _T010DrawingApp0A5SceneC12touchesEndedys3SetVySo7UITouchCG_So7UIEventCSg4withtFTo + 104
11  SpriteKit                           0x000000010a2eabbe -[SKView touchesEnded:withEvent:] + 1083
12  UIKit                               0x0000000107a7ebbb -[UIWindow _sendTouchesForEvent:] + 2807
13  UIKit                               0x0000000107a802de -[UIWindow sendEvent:] + 4124
14  UIKit                               0x0000000107a23e36 -[UIApplication sendEvent:] + 352
15  UIKit                               0x0000000108366434 __dispatchPreprocessedEventFromEventQueue + 2809
16  UIKit                               0x0000000108369089 __handleEventQueueInternal + 5957
17  CoreFoundation                      0x00000001070dd231 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
18  CoreFoundation                      0x000000010717ce41 __CFRunLoopDoSource0 + 81
19  CoreFoundation                      0x00000001070c1b49 __CFRunLoopDoSources0 + 185
20  CoreFoundation                      0x00000001070c112f __CFRunLoopRun + 1279
21  CoreFoundation                      0x00000001070c09b9 CFRunLoopRunSpecific + 409
22  GraphicsServices                    0x000000010f46a9c6 GSEventRunModal + 62
23  UIKit                               0x0000000107a075e8 UIApplicationMain + 159
24  DrawingApp                          0x0000000104071e17 main + 55
25  libdyld.dylib                       0x000000010b0e4d81 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException

1 个答案:

答案 0 :(得分:1)

回溯显示,当DrawingScene.touchesEnded(_:with:)方法调用List.filter(_:)时,会引发异常。异常消息表示您正在将名为id的属性与数字进行比较,而不是像预期的那样将字符串进行比较。