gpt4 book ai didi

ios - RLMException - RLMArray 属性需要定义包含类型的协议(protocol) - 示例 : RLMArray

转载 作者:行者123 更新时间:2023-12-01 20:19:48 28 4
gpt4 key购买 nike

我有一个主 Realm 对象:

@interface MasterRealmObject : RLMObject

@property (nonatomic, strong) RLMArray<IDNameRealmObject *><IDNameRealmObject> *retailerType;

@property (nonatomic, strong) RLMArray<IDNameRealmObject *><IDNameRealmObject> *firmType;

@property (nonatomic, strong) RLMArray<IDNameRealmObject *><IDNameRealmObject> *businessAge;

@property (nonatomic, strong) RLMArray<StateRealmObject *><StateRealmObject> *state;

@property (nonatomic, strong) RLMArray<KYCDocsRealmObject *><KYCDocsRealmObject> *kycDocs;

@property (nonatomic, strong) RLMArray<ProofRealmObject *><ProofRealmObject> *businessDocs;

@property (nonatomic, strong) NSString *ReligareTollFreeNumber;

@end

我正在尝试存储字典中的值,如下所示:
-(void)insertMasterAPIObjects:(NSDictionary *)masterDictionary
{

RLMRealm *realmInsertMasterObjects = [RLMRealm defaultRealm];
[realmInsertMasterObjects beginWriteTransaction];

MasterRealmObject *masterRealm = [[MasterRealmObject alloc]init];
masterRealm.retailerType = [masterDictionary objectForKey:@"retailer_type"];
masterRealm.firmType = [masterDictionary objectForKey:@"firm_type"];
masterRealm.businessAge = [masterDictionary objectForKey:@"BusinessAge"];
masterRealm.kycDocs = [masterDictionary objectForKey:@"kyc_docs"];
masterRealm.businessDocs = [masterDictionary objectForKey:@"business_docs"];
masterRealm.state = [masterDictionary objectForKey:@"states"];

[realmInsertMasterObjects addObject:masterRealm];
[realmInsertMasterObjects commitWriteTransaction];
}

我在这个方法的第一行得到了这个异常。

最佳答案

我遇到了类似的问题,因为我省略了

RLM_ARRAY_TYPE(IDNameRealmObject)
RLM_ARRAY_TYPE(StateRealmObject)
RLM_ARRAY_TYPE(KYCDocsRealmObject)
RLM_ARRAY_TYPE(ProofRealmObject)

我的@interface 声明之前的宏。

关于ios - RLMException - RLMArray 属性需要定义包含类型的协议(protocol) - 示例 : RLMArray<Person>,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35893921/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com