임 : latest_update 필드의 매핑에 문제가 있습니다. JSON 데이터입니다.RestKit - "고급 데이터 개체"의 개체 매핑 문제가 있습니까?
내 웹 서비스에서이 JSON 데이터를 잡 :
{"Places":[
{"place_ID": "7cceedda-ed3a-11e0-a1a8-858e3974979a",
"timestamp": "2011-10-02 23:24:42"
},
{"place_ID": "7cceedda-ed3a-11e0-a1a8-858e3974933x",
"timestamp": "2011-10-02 23:24:42"
},
{"latest_update":"2011-10-13 12:16:17"}]
}
그리고 내가 관리 매핑에 사용하는 코드의 싹둑 :
//Place mapping
if (!self.placeManagedObject){
self.placeManagedObject = [RKManagedObjectMapping
mappingForClass:[Place class]];
self.placeManagedObject.primaryKeyAttribute = @"UUID";
self.placeManagedObject.rootKeyPath = @"places";
[self.placeManagedObject mapKeyPath:@"place_ID"
toAttribute:@"UUID"];
[self.placeManagedObject mapKeyPath:@"timestamp"
toAttribute:@"timestamp"];
[self.placeManagedObject mapRelationship:@"PlaceInformation"
withMapping:self.placeInfoManagedObject];
// Register mapping with the provider - means it will look for
places in the JSON input
[objectManager.mappingProvider
setMapping:self.placeManagedObject forKeyPath:@"places"];
}
//latestDBUpdate timestamp mapping
if (!self.latestDBUpdateManagedObject){
self.latestDBUpdateManagedObject = [RKManagedObjectMapping
mappingForClass:[LatestDBUpdate class]];
self.latestDBUpdateManagedObject.primaryKeyAttribute =
@"latest_update";
self.latestDBUpdateManagedObject.rootKeyPath = @"places";
[self.latestDBUpdateManagedObject mapKeyPath:@"latest_update"
toAttribute:@"latest_update"];
// Register mapping with the provider - means it will look for
places in the JSON input
[objectManager.mappingProvider
setMapping:self.latestDBUpdateManagedObject
forKeyPath:@"latest_update"];
}
RestKit 장소 객체를 매핑합니다 올바른 예 : { "place_ID": "7cceedda-ed3a-11e0-a1a8-858e3974979a", "타임 스탬프": "2011-10-02 23:24:42"장소 객체로} ... , 하지만 latest_update은 LatestDBUpdate 클래스 개체로 매핑되지 않은, 그리고 난 어떤 방법으로이 동작하지 않습니다.
검색과 시도로 인해 해결책을 찾을 수 없기 때문에 누군가에게 답변을 보내주기를 바랍니다. 고맙습니다 토마스