ios - How to Rectify the Relationship Fault in CoreData While parsing RESTKIT? -
i want store ey_connectionusage
entity value ey_connection
entity cell.i have added 2 entities attributes , created relationship name usagedata
.but shows error "<'usagedata' relationship fault>".this method wrote map restkit value coredata.
dataaccesshandler.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>
this means relationship data hasn't been loaded yet, because haven't tried use it. logging object isn't enough load data. whole point of faulting system prevent data being loaded memory @ same time.
so, basically, isn't problem it's fault. when try use data populated , fine.
Comments
Post a Comment