当该对象的 POST/PUT 请求在 RKObjectManager 中失败时,如何丢弃对 NSManagedObject 实例所做的 CoreData 更改?
NSManagedObject *object = ...;
[object setValue:@"test" forKey: @"test"];
[[RKObjectManager sharedManager] postObject:object
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) { NSLog(@"success, nothing to do"); }
failure:^(RKObjectRequestOperation *operation, NSError *error) {
// I want to discard changes made to object here
}
更新:RestKit 0.20