Restkit - 等待完成并在出现故障时停止所有操作

时间:2013-12-13 15:14:44

标签: restkit nsoperation

我有一批请求构建如下:

for(int i = 0; i < count; i++)

{
     RKObjectRequestOperation *operation = [objectManager appropriateObjectRequestOperationWithObject:nil                                           method:RKRequestMethodPOST                                                                       path:@"sync.json"                                                                          parameters: nil];
        [operation setCompletionBlockWithSuccess:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)
        {

        }
                                         failure:^(RKObjectRequestOperation *operation, NSError *error) {

        }];
        [objectManager enqueueObjectRequestOperation:operation];
        [operation waitUntilFinished];
}

在继续之前,代码应该停止并等待每个操作。 如果出现问题,如何停止或更确切地删除所有排队的操作? 也许使用cancelAllObjectRequestOperationsWithMethod

[编辑]

在Restkit 0.20中,最好使用objectManager postObject:reqObj ...

0 个答案:

没有答案