RestKit - 根据传入属性删除对象

时间:2012-06-12 15:53:07

标签: core-data restkit

我正在使用基本的RestKit映射与JSON我通过REST调用接收。

 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,我现在需要检查它是否为“删除”(或其他),如果是,则从数据库中删除该联系人(如果存在)。但是我不知道在哪里放这个。我是否需要创建自己的扩展Object Mapping类来处理这个问题?这有什么例子吗?我的Google Fu在这方面很弱。

0 个答案:

没有答案