Restkit从0.20.0更新到0.24.0 addFetchRequestBlock缺失

时间:2015-09-07 08:03:18

标签: ios objective-c restkit restkit-0.20 restkit-0.24.x

我刚刚将我的restkit cocoapod从0.20.0更新为0.24.0。 现在我有以下功能

-(void)fetchCategoriesOnCompletion:(myCompletion) compblock{
    Mapper *mapper = [Mapper new];
    RKManagedObjectStore *store = [[ASLDataModel sharedDataModel] objectStore];
    NSManagedObjectContext *context = store.mainQueueManagedObjectContext;
    RKObjectManager *objectManager = [mapper mapReisCategorie];

    NSString *urlString = [NSString stringWithFormat:@"webservice/category/get/apikey/%@/language/%@",apikey,language];

    [objectManager addFetchRequestBlock:^NSFetchRequest *(NSURL *URL) {
        RKPathMatcher *pathMatcher = [RKPathMatcher pathMatcherWithPattern:[NSString stringWithFormat:@"/webservice/category/get/apikey/%@/language/%@",apikey,language]];
        NSDictionary *argsDict = nil;
        BOOL match = [pathMatcher matchesPath:[URL relativePath] tokenizeQueryStrings:NO parsedArguments:&argsDict];
        NSLog(@"URL IS %@",[URL relativePath]);
        NSLog(@"PATTERN is %@",pathMatcher.description);
        if (match) {
            NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Reiscategorie"];
            return fetchRequest;
        }
        return nil;
    }];




    NSURLRequest *request = [objectManager requestWithObject:nil method:RKRequestMethodGET path:urlString parameters:nil];
    NSLog(@"REQUEST URL IS %@",request.URL);

    RKManagedObjectRequestOperation *operation = [objectManager managedObjectRequestOperationWithRequest:request managedObjectContext:context success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
        NSError *error = nil;
        BOOL success = [context  save:&error];
        if (!success) RKLogWarning(@"Failed saving managed object context: %@", error);
        NSError *saveError = nil;
        compblock(YES);
    } failure:^(RKObjectRequestOperation *operation, NSError *error) {

    }];
    [objectManager enqueueObjectRequestOperation:operation];
}

我收到了以下错误:

No visible @interface for 'RKObjectManager' declares the selector 'addFetchRequestBlock:'
No visible @interface for 'RKObjectManager' declares the selector 'managedObjectRequestOperationWithRequest:managedObjectContext:success:failure:'

任何人都可以帮我吗?

提前致谢!

0 个答案:

没有答案