【发布时间】:2019-11-05 08:54:24
【问题描述】:
如果我将属性定义为字符串。
@Property NSString * value;
由于未捕获的异常“RLMException”而终止应用程序,原因: '字符串的'__NSCFNumber'类型的无效值'1993654'?'
或者如果定义为整数。
@Property NSInteger value;
由于未捕获的异常“RLMException”而终止应用程序,原因: 'int'的'NSTaggedPointerString'类型的无效值'1973906'
在这两种情况下应用都崩溃了。
崩溃报告。
*** Terminating app due to uncaught exception 'RLMException', reason: 'Invalid value '1973906' of type 'NSTaggedPointerString' for 'int?' property 'MMCase.Id'.'
*** First throw call stack:
(
0 CoreFoundation 0x00007fff23b98bde __exceptionPreprocess + 350
1 libobjc.A.dylib 0x00007fff503b5b20 objc_exception_throw + 48
2 Realm 0x000000010ad75659 _Z17RLMThrowTypeErrorP11objc_objectP15RLMObjectSchemaP11RLMProperty + 617
3 Realm 0x000000010ad766bb _Z27RLMValidateValueForPropertyP11objc_objectP15RLMObjectSchemaP11RLMPropertyb + 3659
4 Realm 0x000000010ab63576 _ZN18RLMAccessorContext18value_for_propertyEP11objc_objectRKN5realm8PropertyEm + 214
5 Realm 0x000000010abd70af _ZN5realm6Object6createIU8__strongP11objc_object18RLMAccessorContextEES0_RT0_RKNSt3__110shared_ptrINS_5RealmEEERKNS_12ObjectSchemaET_bbmPNS_8BasicRowINS_5TableEEE + 431
6 Realm 0x000000010abd8595 RLMCreateObjectInRealmWithValue + 1477
7 Realm 0x000000010ab62c18 _ZN18RLMAccessorContext5unboxIN5realm12BasicRowExprINS1_5TableEEEEET_P11objc_objectbbbm + 296
8 Realm 0x000000010ab745cd _ZN5realm12_GLOBAL__N_112ValueUpdaterIU8__strongP11objc_object18RLMAccessorContextEclEPNS_12BasicRowExprINS_5TableEEE + 157
9 Realm 0x000000010ab735ef
【问题讨论】:
-
您似乎混合了 Int & String。然后某些值对于一种情况或另一种情况无效。
-
能否请您包含崩溃的代码并指出导致崩溃的特定行?实际上,您可能会尝试将无效或零数据存储到您的 var 中,这会导致崩溃。请花点时间查看How to create a Minimal, Complete, and Verifiable example
标签: ios objective-c realm