我有一個Parent
模型,從NSManagedObject
繼承,Child
模型繼承自Parent
。Restkit - 子映射不會繼承其父映射嗎?
這裏是Parent
映射:
RKManagedObjectStore* store = [RKObjectManager sharedManager].objectStore;
RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForEntityWithName:@"Parent" inManagedObjectStore:store];
[mapping mapKeyPath:@"id" toAttribute:@"id"];
[[RKObjectManager sharedManager].mappingProvider addObjectMapping:mapping];
而且Child
映射:
RKManagedObjectStore* store = [RKObjectManager sharedManager].objectStore;
RKManagedObjectMapping* mapping = [RKManagedObjectMapping mappingForEntityWithName:@"Child" inManagedObjectStore:store];
[[RKObjectManager sharedManager].mappingProvider setMapping:mapping forKeyPath:@"child"];
然後,當我嘗試以下JSON對象映射到一個Child
實例:
{
"child": {
"id": 7
}
}
在RestKit跟蹤中,我看到以下mappin爲Child
GS:
mappings =>()
爲什麼不Child
映射從Parent
映射繼承?如何使映射繼承工作?
你解釋清楚爲什麼使孩子繼承其父映射沒有任何意義。謝謝 ! ;) – 2012-07-19 19:20:13