更新后的restkit重复对象

时间:2014-02-22 09:50:36

标签: json core-data restkit

我有一个实体

@implementation CRPolice

@dynamic title;
@dynamic policeId;
@dynamic image;

+ (RKEntityMapping *)mappingInManagedObjectStore:(RKManagedObjectStore *)managedObjectStore {
    RKEntityMapping *mapping = [RKEntityMapping mappingForEntityForName:NSStringFromClass([self class]) inManagedObjectStore:managedObjectStore];
    mapping.identificationAttributes = @[@"policeId"];
    [mapping addAttributeMappingsFromDictionary:@{@"id" : @"policeId",
     @"title" : @"title",                                              
     @"image" : @"image"
     }];

    return mapping;
}

和子实体

@implementation CRPoliceDetails

@dynamic instruction;
@dynamic documents;

+ (RKEntityMapping *)mappingInManagedObjectStore:(RKManagedObjectStore *)managedObjectStore {
    RKEntityMapping *mapping = [super mappingInManagedObjectStore:managedObjectStore];

    [mapping addAttributeMappingsFromDictionary:@{@"instruction" : @"instruction", @"documents" : @"documents" }];
    return mapping;
}


@end

http://panel.mosavtourist.ru/mobile_dev.php/main/policeList a加载第一个实体后有一个列表对象

但更新子实体urltolist /:id后我的列表对象启动重复对象

在更新明细实体http://joxi.ru/C3MIUxjKTJAVR0wryU8

之前和之后查看屏幕

出了什么问题?

跟踪日志

2014-02-22 16:30:35.329 Mosavtourist[67849:907] CRPoliceDetails objects fetched from cache: 0
2014-02-22 16:30:35.329 Mosavtourist[67849:907] Start loading data at resource path: /index.php/main/policeList/4
2014-02-22 16:30:35.464 Mosavtourist[67849:210f] D restkit.object_mapping:RKMapperOperation.m:378 Executing mapping operation for representation: {
    documetns = "";
    id = 4;
    image = "http://panel.mosavtourist.ru/uploads/police/93872733a4e0009575e4b3e856899a0b159b64f5.png";
    instruction = "";
    key = a87ff679a2f3e71d9181a67b7542122c;
    title = "\U0412\U044b\U0435\U0437\U0434 \U043d\U0430 \U00ab\U0432\U0441\U0442\U0440\U0435\U0447\U043a\U0443\U00bb";
}
 and targetObject: (null)
2014-02-22 16:30:35.464 Mosavtourist[67849:210f] T restkit.object_mapping:RKMapperOperation.m:321 Examining keyPath '' for mappable content...
2014-02-22 16:30:35.464 Mosavtourist[67849:210f] D restkit.object_mapping:RKMapperOperation.m:301 Found mappable data at keyPath '': {
    documetns = "";
    id = 4;
    image = "http://panel.mosavtourist.ru/uploads/police/93872733a4e0009575e4b3e856899a0b159b64f5.png";
    instruction = "";
    key = a87ff679a2f3e71d9181a67b7542122c;
    title = "\U0412\U044b\U0435\U0437\U0434 \U043d\U0430 \U00ab\U0432\U0441\U0442\U0440\U0435\U0447\U043a\U0443\U00bb";
}
2014-02-22 16:30:35.465 Mosavtourist[67849:210f] D restkit.object_mapping:RKMapperOperation.m:230 Asked to map source object {
    documetns = "";
    id = 4;
    image = "http://panel.mosavtourist.ru/uploads/police/93872733a4e0009575e4b3e856899a0b159b64f5.png";
    instruction = "";
    key = a87ff679a2f3e71d9181a67b7542122c;
    title = "\U0412\U044b\U0435\U0437\U0434 \U043d\U0430 \U00ab\U0432\U0441\U0442\U0440\U0435\U0447\U043a\U0443\U00bb";
} with mapping <RKEntityMapping:0xa35e0a0 objectClass=CRPoliceDetails propertyMappings=(
    "<RKAttributeMapping: 0xa369ef0 title => title>",
    "<RKAttributeMapping: 0xa369f20 id => policeId>",
    "<RKAttributeMapping: 0xa369f40 key => key>",
    "<RKAttributeMapping: 0xa369fb0 image => image>",
    "<RKAttributeMapping: 0xa36a050 instruction => instruction>",
    "<RKAttributeMapping: 0xa36a0f0 documents => documents>"
)>
2014-02-22 16:30:35.465 Mosavtourist[67849:210f] D restkit.object_mapping:RKMappingOperation.m:860 Starting mapping operation...
2014-02-22 16:30:35.465 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:861 Performing mapping operation: <RKMappingOperation 0xa368360> for 'CRPoliceDetails' object. Mapping values from object {
    documetns = "";
    id = 4;
    image = "http://panel.mosavtourist.ru/uploads/police/93872733a4e0009575e4b3e856899a0b159b64f5.png";
    instruction = "";
    key = a87ff679a2f3e71d9181a67b7542122c;
    title = "\U0412\U044b\U0435\U0437\U0434 \U043d\U0430 \U00ab\U0432\U0441\U0442\U0440\U0435\U0447\U043a\U0443\U00bb";
} to object <CRPoliceDetails: 0xa3b7190> (entity: CRPoliceDetails; id: 0xa3b71d0 <x-coredata:///CRPoliceDetails/t6FC46512-72FB-41C3-AB30-94D80C9389F93> ; data: {
    documents = nil;
    image = nil;
    instruction = nil;
    key = a87ff679a2f3e71d9181a67b7542122c;
    policeId = 0;
    title = nil;
}) with object mapping (null)
2014-02-22 16:30:35.466 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:438 Found transformable value at keyPath 'title'. Transforming from class '__NSCFString' to 'NSString'
2014-02-22 16:30:35.466 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:453 Mapping attribute value keyPath 'title' to 'title'
2014-02-22 16:30:35.466 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:469 Mapped attribute value from keyPath 'title' to 'title'. Value: Выезд на «встречку»
2014-02-22 16:30:35.467 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:438 Found transformable value at keyPath 'id'. Transforming from class '__NSCFString' to 'NSNumber'
2014-02-22 16:30:35.467 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:453 Mapping attribute value keyPath 'id' to 'policeId'
2014-02-22 16:30:35.467 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:469 Mapped attribute value from keyPath 'id' to 'policeId'. Value: 4
2014-02-22 16:30:35.467 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:438 Found transformable value at keyPath 'key'. Transforming from class '__NSCFString' to 'NSString'
2014-02-22 16:30:35.467 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:453 Mapping attribute value keyPath 'key' to 'key'
2014-02-22 16:30:35.468 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:484 Skipped mapping of attribute value from keyPath 'key to keyPath 'key' -- value is unchanged (a87ff679a2f3e71d9181a67b7542122c)
2014-02-22 16:30:35.468 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:438 Found transformable value at keyPath 'image'. Transforming from class '__NSCFString' to 'NSString'
2014-02-22 16:30:35.468 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:453 Mapping attribute value keyPath 'image' to 'image'
2014-02-22 16:30:35.468 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:469 Mapped attribute value from keyPath 'image' to 'image'. Value: http://panel.mosavtourist.ru/uploads/police/93872733a4e0009575e4b3e856899a0b159b64f5.png
2014-02-22 16:30:35.468 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:438 Found transformable value at keyPath 'instruction'. Transforming from class '__NSCFConstantString' to 'NSString'
2014-02-22 16:30:35.469 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:453 Mapping attribute value keyPath 'instruction' to 'instruction'
2014-02-22 16:30:35.469 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:469 Mapped attribute value from keyPath 'instruction' to 'instruction'. Value: 
2014-02-22 16:30:35.469 Mosavtourist[67849:210f] T restkit.object_mapping:RKMappingOperation.m:518 Did not find mappable attribute value keyPath 'documents'
2014-02-22 16:30:35.469 Mosavtourist[67849:210f] D restkit.object_mapping:RKMappingOperation.m:929 Finished mapping operation successfully...
2014-02-22 16:30:35.470 Mosavtourist[67849:210f] D restkit.object_mapping:RKMapperOperation.m:404 Finished performing object mapping. Results: {
    "" = "<CRPoliceDetails: 0xa3b7190> (entity: CRPoliceDetails; id: 0xa3b71d0 <x-coredata:///CRPoliceDetails/t6FC46512-72FB-41C3-AB30-94D80C9389F93> ; data: {\n    documents = nil;\n    image = \"http://panel.mosavtourist.ru/uploads/police/93872733a4e0009575e4b3e856899a0b159b64f5.png\";\n    instruction = \"\";\n    key = a87ff679a2f3e71d9181a67b7542122c;\n    policeId = 4;\n    title = \"\\U0412\\U044b\\U0435\\U0437\\U0434 \\U043d\\U0430 \\U00ab\\U0432\\U0441\\U0442\\U0440\\U0435\\U0447\\U043a\\U0443\\U00bb\";\n})";
}
2014-02-22 16:30:35.476 Mosavtourist[67849:907] Successfully finished loading data at resource path: /index.php/main/policeList/4

0 个答案:

没有答案