gpt4 book ai didi

ios - RESTKIT解析CoreData关系错误如何解决?

转载 作者:行者123 更新时间:2023-11-29 01:17:10 25 4
gpt4 key购买 nike

我想将 EY_ConnectionUsage 实体值存储到 EY_Connection 实体 Cell。我添加了两个具有属性的实体并创建了名称为 usageData 的关系>.但这显示错误“<'usageData' Relationship Fault>”。这是我编写的将 RESTKIT 值映射到 CoreData 的方法。

数据访问处理器.m

+(void)createConnectionMappingWithStore:(RKManagedObjectStore *)managedObjectStore saveInDelegate:(AppDelegate *)appDelegate{

NSLog(@"appdele==>>%@",appDelegate);
RKEntityMapping *connectionMapping = [RKEntityMapping mappingForEntityForName:@"EY_Connections" inManagedObjectStore:managedObjectStore];
connectionMapping.identificationAttributes = @[@"connectionNumber"];
[connectionMapping addAttributeMappingsFromDictionary:@{ @"ServiceNo" : @"connectionServiceNumber", @"Name" : @"connectionName", @"Region" : @"connectionRegion", @"Phase" : @"connectionPhase",
@"Circle" : @"connectionCircle", @"Section" : @"connectionSection", @"Load" : @"connectionLoad",
@"Distribution" : @"connectionDistribution", @"MeterNo" : @"connectionMeterNumber", @"ConnectionNumber" : @"connectionNumber", @"Address" : @"connectionAddress", @"ServiceStatus" : @"connectionStatus"}];



RKEntityMapping *connectionUsageMapping = [RKEntityMapping mappingForEntityForName:@"EY_ConnectionUsage" inManagedObjectStore:managedObjectStore];
connectionUsageMapping.identificationAttributes = @[@"usageAssessmentDate"];
[connectionUsageMapping addAttributeMappingsFromDictionary:@{ @"assessment_date" : @"usageAssessmentDate", @"reading" : @"usageReading", @"units" : @"usageUnits", @"amount" : @"usageAmount",
@"payment_date" : @"usagePaymentDate", @"status" : @"usageStatus"}];

[connectionMapping addPropertyMapping:[RKRelationshipMapping relationshipMappingFromKeyPath:@"usage" toKeyPath:@"usageData" withMapping:connectionUsageMapping]];

RKResponseDescriptor *articleListResponseDescriptor =
[RKResponseDescriptor responseDescriptorWithMapping:connectionMapping
method:RKRequestMethodGET
pathPattern:@"user_history/consumer/data.json"
keyPath:nil
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)
];

[appDelegate createObjectManagerForurl:@"http://sciflare.com/energyly/api/" andAddResponseDescriptor:articleListResponseDescriptor];
[AFNetworkActivityIndicatorManager sharedManager].enabled = YES;

}

最佳答案

<'usageData' Relationship Fault>

这意味着关系数据尚未加载,因为您还没有尝试使用它。记录对象不足以加载数据。故障系统的全部意义在于防止同时将太多数据加载到内存中。

所以,基本上,它不是故障。当您尝试使用它时,数据将被填充,一切都会好起来的。

关于ios - RESTKIT解析CoreData关系错误如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35034460/

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