Core data RestKit-基于传入属性删除对象
我正在使用基本的RestKit映射,并通过REST调用接收JSONCore data RestKit-基于传入属性删除对象,core-data,restkit,Core Data,Restkit,我正在使用基本的RestKit映射,并通过REST调用接收JSON RKManagedObjectMapping* contactMapping = [RKManagedObjectMapping mappingForClass:[Contact class]]; [contactMapping mapAttributes:@"id", @"firstName", @"middleName", @"lastName", @"title", @"email", nil]; contactMapp
RKManagedObjectMapping* contactMapping = [RKManagedObjectMapping mappingForClass:[Contact class]];
[contactMapping mapAttributes:@"id", @"firstName", @"middleName", @"lastName", @"title", @"email", nil];
contactMapping.primaryKeyAttribute = @"id";
[contactMapping mapRelationship:@"addresses" withMapping:addressMapping];
[contactMapping mapRelationship:@"phoneNumbers" withMapping:phoneMapping];
// Register our mappings with the provider
[objectManager.mappingProvider setMapping:contactMapping forKeyPath:@"contacts"];
我有一个新的字段,status,我现在需要检查它是否是“Delete”(或其他什么),如果是,则从数据库中删除该联系人(如果存在)。但是我不知道该把它放在哪里。我是否需要创建自己的扩展对象映射类来处理此问题?这方面有什么例子吗?我的Google Fu在这一点上很弱 我认为这种功能应该放在
didReceivedObjects
delegate方法中。只需在接收到的对象上迭代并删除那些与您的请求匹配的对象。