我需要幫助嵌套對象映射,我想我碰到一個錯誤。RestKit - 嵌套對象映射失敗,如果嵌套值是一個域名
當嵌套值是一個域(something.com)時,restkit將它替換爲嵌套屬性並嘗試查找「something.com.name」,「something.com.url」,「something.com.email 「,假設2個嵌套,」東西「和」com「,因此失敗。
這裏是映射失敗的日誌:
2014-01-07 14:14:25.408 MyAppName[923:7003] D restkit.object_mapping:RKMapperOperation.m:231 Asked to map source object {
"myservice.co.tz" = {
countries = (
tz
);
flag = tz;
name = Tanzania;
url = "http://www.MyAppName.co.tz";
};
} with mapping <RKObjectMapping:0x15591b20 objectClass=LMCountry propertyMappings=(
"<RKAttributeMapping: 0x15591e10 <RK_NESTING_ATTRIBUTE> => host>",
"<RKAttributeMapping: 0x15591f80 (host).name => name>",
"<RKAttributeMapping: 0x15592030 (host).currency => currency>",
"<RKAttributeMapping: 0x155921b0 (host).flag => flag>",
"<RKAttributeMapping: 0x155921f0 (host).url => url>",
"<RKAttributeMapping: 0x15591ee0 (host).countries => countries>"
)>
2014-01-07 14:14:25.411 MyAppName[923:7003] D restkit.object_mapping:RKMappingOperation.m:952 Starting mapping operation...
2014-01-07 14:14:25.415 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:953 Performing mapping operation: <RKMappingOperation 0x155a4600> for 'LMCountry' object. Mapping values from object {
"MyAppName.co.tz" = {
countries = (
tz
);
flag = tz;
name = Tanzania;
url = "http://www.MyAppName.co.tz";
};
} to object <LMCountry: 0x155a60f0> with object mapping (null)
2014-01-07 14:14:25.418 MyAppName[923:7003] D restkit.object_mapping:RKMappingOperation.m:914 Found nested mapping definition to attribute 'host'
2014-01-07 14:14:25.420 MyAppName[923:7003] D restkit.object_mapping:RKMappingOperation.m:917 Found nesting value of 'MyAppName.co.tz' for attribute 'host'
2014-01-07 14:14:25.422 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:550 Mapping attribute value keyPath '<RK_NESTING_ATTRIBUTE>' to 'host'
2014-01-07 14:14:25.424 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:572 Mapped attribute value from keyPath '<RK_NESTING_ATTRIBUTE>' to 'host'. Value: MyAppName.co.tz
2014-01-07 14:14:25.427 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:605 Skipping attribute mapping for special keyPath '<RK_NESTING_ATTRIBUTE>'
2014-01-07 14:14:25.429 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:617 Did not find mappable attribute value keyPath 'MyAppName.co.tz.name'
2014-01-07 14:14:25.431 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:617 Did not find mappable attribute value keyPath 'MyAppName.co.tz.currency'
2014-01-07 14:14:25.433 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:617 Did not find mappable attribute value keyPath 'MyAppName.co.tz.flag'
2014-01-07 14:14:25.435 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:617 Did not find mappable attribute value keyPath 'MyAppName.co.tz.url'
2014-01-07 14:14:25.437 MyAppName[923:7003] T restkit.object_mapping:RKMappingOperation.m:617 Did not find mappable attribute value keyPath 'MyAppName.co.tz.countries'
2014-01-07 14:14:25.439 MyAppName[923:7003] D restkit.object_mapping:RKMappingOperation.m:1021 Finished mapping operation successfully...
您可以發佈您RestKit映射代碼爲這個對象? – danielM