3
當我發出請求並嘗試將響應放入核心數據時,出現以下錯誤。RestKit 0.20映射問題
Performing managed object mapping with a nil managed object cache:
Unable to update existing object instances by identification attributes. Duplicate objects may be created.
我設置了identifactionAttributes,我使用對象管理器來配置請求操作。我仍然收到「無法更新現有的對象實例......」
objectMapping = [RKEntityMapping mappingForEntityForName:@"Entity" inManagedObjectStore:self.managedObjectStore];
objectMapping.identificationAttributes = @[ @"route_id" ];
[objectMapping addAttributeMappingsFromDictionary:@{
@"point_alt" : @"point_alt",
@"point_lat" : @"point_lat",
@"point_long" : @"point_long",
@"location_id" : @"location_id",
@"route_id" : @"route_id"
}];
NSMutableURLRequest *request = [[RKObjectManager sharedManager] requestWithObject:nil method:RKRequestMethodPOST path:path parameters:paramsWithEncr];
RKManagedObjectRequestOperation *operation = [[RKObjectManager sharedManager] managedObjectRequestOperationWithRequest:request managedObjectContext:self.managedObjectStore.mainQueueManagedObjectContext success:^(RKObjectRequestOperation *operation, RKMappingResult *result) {
NSLog(@"Loading mapping result: %d", result.count);
} failure:^(RKObjectRequestOperation *operation, NSError *error) {
NSLog(@"Fail!");
}];
你收到的消息只是一個警告。你只是想擺脫警告?或者你有更大的問題?就像沒有對象存儲在數據庫中一樣? – plu
沒有對象存儲在數據庫中... –