Note that there are some explanatory texts on larger screens.

plurals
  1. PORestKit Arbitrary Keys Object Mapping
    primarykey
    data
    text
    <p>I have a JSON that looks like this here: </p> <pre><code> { "key1":[ { "desc":"key1decs.", "duration":50; },{ "desc":"", "duration":90; },{ "desc":"Kurz vor...", "duration":30; } ], "key2":[ { "desc":"key2decs.", "duration":50; },{ "desc":"blabla", "duration":90; } ] } </code></pre> <p>I am trying to do a mapping. But I'm stuck because of different unknown/arbitrary keys. I tried mapping without KVC, but it seems not to be working. Gives me error: Failed transformation of value at keyPath 'key1.desc'. No strategy for transforming from '__NSArrayI' to 'NSString'. and so on for every attribute. I saw on the web that mapping without KVC doesn't support arrays as inner structures. Plz, help. What is right approach here? </p> <p>EDIT: ENtity:</p> <pre><code>@interface Sendung : NSObject @property (nonatomic, strong) NSString *description; @property (nonatomic, strong) NSNumber *duration; @property (nonatomic, strong) NSNumber *sendungkey; @end; </code></pre> <p>Controller:</p> <pre><code> RKObjectMapping* mapping = [RKObjectMapping mappingForClass:[Sendung class]]; mapping.forceCollectionMapping = YES; [mapping mapKeyOfNestedDictionaryToAttribute:@"sendungkey"]; [mapping mapKeyPath:@"(sendungkey).desc" toAttribute:@"description"]; [mapping mapKeyPath:@"(sendungkey).duration" toAttribute:@"duration"]; [[RKObjectManager sharedManager].mappingProvider addObjectMapping:mapping ]; mapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[Sendung class] ]; [[RKObjectManager sharedManager] loadObjectsAtResourcePath:url objectMapping:mapping delegate:self]; </code></pre> <p>This is what I get when NSlogin result: ( (null), (null), (null), (null), (null) )</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload