我正在尝试映射以下对象:
{"walletAccepted":false,"creditCardTypesAccepted":["visa","mastercard","discover","americanexpress"],"paypalAccepted":false}
到具有相同属性的对象。但是,ResourcePath 是动态的,因为它遵循 /paymentmethods/zone/:internalZoneCode
我在映射时所做的每一次尝试总是以“映射期间遇到错误:找不到 keyPath 的对象映射:''”而告终
我认为问题在于没有根密钥/密钥路径。我还尝试了以下方法,但没有运气:
RKURL *rkUrl = [RKURL URLWithBaseURL:[RKClient sharedClient].baseURL resourcePath:[NSString stringWithFormat:@"/paymentoptions/zone/%@", zoneNumber]];
RKObjectLoader* loader = [[RKObjectLoader alloc] initWithURL:rkUrl mappingProvider:[RKObjectManager sharedManager].mappingProvider];
loader.method = RKRequestMethodGET;
loader.delegate = self;
loader.objectMapping = [[RKObjectManager sharedManager].mappingProvider objectMappingForClass:[PMZonePaymentMethods class]];
[loader send];