0

我过早升级到 macOS High Sierra 犯了一个大错误。现在,每当我尝试Realm通过简单地调用来获得模拟器中的默认值时let realm = try! Realm(),应用程序都会崩溃并显示以下跟踪。

17-09-27 00:42:12.066162+0900 Lulu[94661:1045399] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSInvocation getArgument:atIndex:]: struct with unknown contents found while getting argument at index -1'
*** First throw call stack:
(
0   CoreFoundation                      0x00000001123381cb __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x0000000111c9af41 objc_exception_throw + 48
2   CoreFoundation                      0x00000001122bb549 -[NSInvocation getArgument:atIndex:] + 473
3   Foundation                          0x000000011173ba34 _NSGetValueWithMethod + 174
4   Foundation                          0x00000001116b5500 -[NSObject(NSKeyValueCoding) valueForKey:] + 284
5   Realm                               0x0000000110392709 -[RLMObjectBase valueForKey:] + 185
6   Realm                               0x00000001103bac13 -[RLMProperty initSwiftPropertyWithName:indexed:linkPropertyDescriptor:property:instance:] + 691
7   Realm                               0x0000000110399752 +[RLMObjectSchema propertiesForClass:isSwift:] + 1922
8   Realm                               0x000000011039745d +[RLMObjectSchema schemaForObjectClass:] + 941
9   Realm                               0x00000001104fd49b _ZL16RLMRegisterClassP10objc_class + 299
10  Realm                               0x00000001104fe83d __25+[RLMSchema sharedSchema]_block_invoke + 77
11  CoreFoundation                      0x00000001122bcf72 -[__NSDictionaryM enumerateKeysAndObjectsWithOptions:usingBlock:] + 226
12  Realm                               0x00000001104fe4f4 +[RLMSchema sharedSchema] + 1044
13  Realm                               0x00000001104db934 +[RLMRealm realmWithConfiguration:error:] + 5620
14  RealmSwift                          0x0000000110e1ea72 _T0So8RLMRealmCABSo0A13ConfigurationC13configuration_tKcfCTO + 162
15  RealmSwift                          0x0000000110e1e8ee _T010RealmSwift0A0CACyKcfc + 126
16  RealmSwift                          0x0000000110e1e816 _T010RealmSwift0A0CACyKcfC + 54
17  Lulu                                0x000000010eab258e _T010Lulu15QuestionsLoaderC19loadDbQuestionnaire33_B2763018E452D760653439DEADCB4F03LLAA0G0CSgyF + 46
18  Lulu                                0x000000010eab2155 _T010Lulu15QuestionsLoaderC04loadC033_B2763018E452D760653439DEADCB4F03LLyyKF + 37
19  Lulu                                0x000000010eab10d4 _T010Lulu15QuestionsLoaderC13questionnaireAA13QuestionnaireCfg + 228
20  Lulu                                0x000000010ea939b9 _T010Lulu22QuestionnairePresenterCAcA0C4View_p08questionE0_tcfc + 201
21  Lulu                                0x000000010ea938a2 _T010Lulu22QuestionnairePresenterCAcA0C4View_p08questionE0_tcfC + 50
22  Lulu                                0x000000010e98757f _T010Lulu27QuestionnaireViewControllerC11viewDidLoadyyF + 191
23  Lulu                                0x000000010e988a84 _T010Lulu27QuestionnaireViewControllerC11viewDidLoadyyFTo + 36
24  UIKit                               0x0000000113441d51 -[UIViewController loadViewIfRequired] + 1235
25  UIKit                               0x000000011344219e -[UIViewController view] + 27
26  UIKit                               0x000000011347413b -[UINavigationController _startCustomTransition:] + 954
27  UIKit                               0x000000011348a894 -[UINavigationController _startDeferredTransitionIfNeeded:] + 686
28  UIKit                               0x000000011348bb90 -[UINavigationController __viewWillLayoutSubviews] + 115
29  UIKit                               0x00000001136e22ae -[UILayoutContainerView layoutSubviews] + 231
30  UIKit                               0x0000000113372551 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1331
31  QuartzCore                          0x000000011ba184ba -[CALayer layoutSublayers] + 153
32  QuartzCore                          0x000000011ba1c5a9 _ZN2CA5Layer16layout_if_neededEPNS_11TransactionE + 401
33  QuartzCore                          0x000000011b9a51cd _ZN2CA7Context18commit_transactionEPNS_11TransactionE + 365
34  QuartzCore                          0x000000011b9d0ae4 _ZN2CA11Transaction6commitEv + 500
35  UIKit                               0x000000011329df4a _UIApplicationFlushRunLoopCATransactionIfTooLate + 167
36  UIKit                               0x0000000113bf5960 __handleEventQueueInternal + 6894
37  CoreFoundation                      0x00000001122db2b1 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
38  CoreFoundation                      0x000000011237ad31 __CFRunLoopDoSource0 + 81
39  CoreFoundation                      0x00000001122bfc19 __CFRunLoopDoSources0 + 185
40  CoreFoundation                      0x00000001122bf1ff __CFRunLoopRun + 1279
41  CoreFoundation                      0x00000001122bea89 CFRunLoopRunSpecific + 409
42  GraphicsServices                    0x000000011a5379c6 GSEventRunModal + 62
43  UIKit                               0x00000001132a3d30 UIApplicationMain + 159
44  Lulu                                0x000000010e9dbc07 main + 55
45  libdyld.dylib                       0x0000000116e95d81 start + 1
)

我的安装如下:

  • Xcode 9.0
  • Cocoapods 1.3.1
  • 领域 2.10.1
  • 斯威夫特 3.2
  • SSD 硬盘,这意味着我有 APFS
  • 文件保险箱已启用

我试图在网上找到任何东西,显然没有任何东西。
我也试过(但没用):

  • 卸下和重新安装 pod
  • 删除领域文件
  • 在模拟器中删除并重新安装应用程序
  • 删除 Xcode 的派生数据
4

1 回答 1

5

显然,我非常短视(我确实应该得到那些反对票),这与我的想法无关。

通过Realm's 代码调试异常,发现崩溃是id propertyValue = [obj valueForKey:_name];[RLMProperty initSwiftPropertyWithName:indexed:linkPropertyDescriptor:property:instance:].

实际问题是我添加了一个Decimal不支持的类型字段Realm

于 2017-09-28T13:46:28.897 回答