【问题标题】:Debugging Realm, call stack does not have any app code调试Realm,调用栈没有任何app代码
【发布时间】:2017-11-07 04:56:14
【问题描述】:

我遇到过几次,应用程序会因为 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

【问题讨论】:

  • 调用堆栈中有几帧来自您的应用程序的代码,包括对 Realm 的调用导致异常被抛出。

标签: swift realm stack-trace


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2021-03-26
    • 1970-01-01
    • 2015-11-13
    • 2012-01-11
    • 2011-09-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-08
    相关资源
    最近更新 更多