我正在尝试删除RLMObject子类的每个实例,每当我调用[Realm defaultRealm]我的应用程序崩溃时。这是我一直在控制台中得到的东西。我正在使用cocoapods,版本0.93.2
*** Terminating app due to uncaught exception 'RLMException', reason: 'Can't persist property 'Id' with incompatible type. Add to ignoredPropertyNames: method to ignore.'
*** First throw call stack:
(
0 CoreFoundation 0x0000000106b15c65 __exceptionPreprocess + 165
1 libobjc.A.dylib 0x00000001067aebb7 objc_exception_throw + 45
2 business_sect 0x000000010206251b -[RLMProperty initWithName:indexed:property:] + 571
3 business_sect 0x00000001020511c1 +[RLMObjectSchema propertiesForClass:isSwift:] + 1457
4 business_sect 0x000000010204fa5c +[RLMObjectSchema schemaForObjectClass:] + 812
5 business_sect 0x00000001020c4d06 +[RLMSchema initialize] + 1862
6 libobjc.A.dylib 0x00000001067af4d6 _class_initialize + 648
7 libobjc.A.dylib 0x00000001067b86e1 lookUpImpOrForward + 351
8 libobjc.A.dylib 0x00000001067c50d3 objc_msgSend + 211
9 business_sect 0x00000001020aa34d +[RLMRealm realmWithPath:key:readOnly:inMemory:dynamic:schema:error:] + 4765
10 business_sect 0x00000001020a8d78 +[RLMRealm realmWithPath:readOnly:error:] + 152
11 business_sect 0x00000001020a8bdf +[RLMRealm defaultRealm] + 111
12 business_sect 0x0000000101f386ff __40-[CGCUserManager signInUser:completion:]_block_invoke + 879
13 business_sect 0x0000000101fd39d8 __64-[AFHTTPRequestOperation setCompletionBlockWithSuccess:failure:]_block_invoke46 + 40
14 libdispatch.dylib 0x0000000107095186 _dispatch_call_block_and_release + 12
15 libdispatch.dylib 0x00000001070b4614 _dispatch_client_callout + 8
16 libdispatch.dylib 0x000000010709ca1c _dispatch_main_queue_callback_4CF + 1664
17 CoreFoundation 0x0000000106a7d1f9 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
18 CoreFoundation 0x0000000106a3edcb __CFRunLoopRun + 2043
19 CoreFoundation 0x0000000106a3e366 CFRunLoopRunSpecific + 470
20 GraphicsServices 0x0000000107d63a3e GSEventRunModal + 161
21 UIKit 0x0000000104e6d8c0 UIApplicationMain + 1282
22 business_sect 0x0000000101f6927f main + 111
23 libdyld.dylib 0x00000001070e8145 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)
编辑:我也在iphone6模拟器上进行测试
这是RLMObject子类:
#import "RLMObject.h"
@interface CGCUser : RLMObject
@property NSString *EmailAddress;
@property BOOL IsActive;
@end
还有第二个对象
@interface CGCCardInfo : RLMObject
@property NSInteger *Id;
@property NSString *nickName;
@property NSString *token;
@property NSString *displayNumber;
@property BOOL *isDefault;
@property NSString *cardType;
@end
RLM_ARRAY_TYPE(CGCCardInfo)
答案 0 :(得分:1)
问题在于行@property BOOL *isDefault;
如果您将其更改为@property BOOL isDefault;
,那么它应该完全符合您的要求!
答案 1 :(得分:0)
同样的事发生在我身上。
@property NSInteger *Id
是这里有问题的领域。您使用指针NSInteger
而不是NSInteger
本身。
解决方案是将其替换为直接引用:@property NSInteger Id